2 # Copyright (C) 2004-2016 ZNC, see the NOTICE file for details.
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
8 # http://www.apache.org/licenses/LICENSE-2.0
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.
17 include("${CMAKE_CURRENT_LIST_DIR}/znc.cmake")
18 include(CMakeParseArguments)
20 # For some reason cygwin fails to build modules if Threads::Threads
23 set(ZNC_NO_INCLUDE_THREADS true)
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.")
36 function(znc_setup_module)
37 cmake_parse_arguments(znc_mod "" "TARGET;NAME" "" ${ARGN})
38 set_target_properties("${znc_mod_TARGET}" PROPERTIES
40 CXX_STANDARD_REQUIRED true
41 OUTPUT_NAME "${znc_mod_NAME}"
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}")
51 message(STATUS "Found ZNC @ZNC_VERSION@")