]> jfr.im git - irc/evilnet/znc.git/blob - ZNCConfig.cmake.in
Merge pull request #1383 from Phansa/master
[irc/evilnet/znc.git] / ZNCConfig.cmake.in
1 #
2 # Copyright (C) 2004-2016 ZNC, see the NOTICE file for details.
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 #
16
17 include("${CMAKE_CURRENT_LIST_DIR}/znc.cmake")
18 include(CMakeParseArguments)
19
20 # For some reason cygwin fails to build modules if Threads::Threads
21 # is not found.
22 if(NOT CYGWIN)
23 set(ZNC_NO_INCLUDE_THREADS true)
24 endif()
25
26 if(NOT ZNC_NO_INCLUDE_THREADS)
27 set(CMAKE_THREAD_PREFER_PTHREAD true)
28 set(THREADS_PREFER_PTHREAD_FLAG true)
29 find_package(Threads REQUIRED)
30 if(NOT CMAKE_USE_PTHREADS_INIT)
31 message(FATAL_ERROR "This compiler/OS doesn't seem "
32 "to support pthreads.")
33 endif()
34 endif()
35
36 function(znc_setup_module)
37 cmake_parse_arguments(znc_mod "" "TARGET;NAME" "" ${ARGN})
38 set_target_properties("${znc_mod_TARGET}" PROPERTIES
39 CXX_STANDARD 11
40 CXX_STANDARD_REQUIRED true
41 OUTPUT_NAME "${znc_mod_NAME}"
42 PREFIX ""
43 SUFFIX ".so"
44 NO_SONAME true
45 CXX_VISIBILITY_PRESET "hidden"
46 COMPILE_DEFINITIONS "znc_export_lib_EXPORTS")
47 set(znc_link "@znc_link@")
48 target_link_libraries("${znc_mod_TARGET}" PUBLIC "znc_internal_${znc_link}")
49 endfunction()
50
51 message(STATUS "Found ZNC @ZNC_VERSION@")