File tree Expand file tree Collapse file tree 2 files changed +16
-18
lines changed
Expand file tree Collapse file tree 2 files changed +16
-18
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,13 @@ file(GLOB SOURCES Lib/*.c)
4444if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" )
4545 set (SOURCES ${SOURCES} Lib/poll_plugins/epoll_priv.c)
4646else ()
47- find_package (Kqueue REQUIRED)
47+ include (CheckFunctionExists)
48+ check_function_exists(kqueue KQUEUE_IN_LIBC)
49+ if (NOT KQUEUE_IN_LIBC)
50+ find_package (Kqueue REQUIRED)
51+ else ()
52+ set (KQUEUE_LIBRARIES "" )
53+ endif ()
4854 set (SOURCES ${SOURCES} Lib/poll_plugins/kqueue_priv.c)
4955endif ()
5056
@@ -68,8 +74,7 @@ set_target_properties(
6874set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wtype-limits -Wstrict-overflow -fno-strict-aliasing -Wformat -Wformat-security" )
6975set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -fvisibility=hidden" )
7076
71- # KQUEUE_INCLUDE_DIRS will be empty where native epoll/kqueue are supported
72- target_include_directories (${PROJECT_NAME} PRIVATE Lib/ Lib/public /module/ ${KQUEUE_INCLUDE_DIRS} )
77+ target_include_directories (${PROJECT_NAME} PRIVATE Lib/ Lib/public /module/)
7378
7479# KQUEUE_LIBRARIES will be empty where native epoll/kqueue are supported
7580target_link_libraries (${PROJECT_NAME} ${KQUEUE_LIBRARIES} )
Original file line number Diff line number Diff line change 11include (FindPackageHandleStandardArgs)
2- include (CheckFunctionExists)
32
43find_package (Threads)
54
65find_path (KQUEUE_INCLUDE_DIRS sys/event.h PATH_SUFFIXES kqueue)
76
8- check_function_exists(KQUEUE_IN_LIBC kqueue)
9-
10- if (KQUEUE_IN_LIBC)
11- set (_KQUEUE_LIB " " )
12- else ()
13- find_library (_KQUEUE_LIB "kqueue" )
14- mark_as_advanced (_KQUEUE_LIB)
15- endif ()
16-
17- set (KQUEUE_LIBRARIES "${_KQUEUE_LIB} " ${CMAKE_THREAD_LIBS_INIT}
18- CACHE STRING "Libraries to link libkqueue" )
7+ find_library (_KQUEUE_LIB "kqueue" )
8+ mark_as_advanced (_KQUEUE_LIB)
9+ set (KQUEUE_LIBRARIES "${_KQUEUE_LIB} " ${CMAKE_THREAD_LIBS_INIT}
10+ CACHE STRING "Libraries to link libkqueue" )
1911
2012find_package_handle_standard_args(kqueue DEFAULT_MSG
21- KQUEUE_LIBRARIES
22- KQUEUE_INCLUDE_DIRS
23- THREADS_FOUND
13+ KQUEUE_LIBRARIES
14+ KQUEUE_INCLUDE_DIRS
15+ THREADS_FOUND
2416)
17+
You can’t perform that action at this time.
0 commit comments