diff options
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/checks.cmake | 20 | ||||
-rw-r--r-- | cmake/config.cmake | 9 | ||||
-rw-r--r-- | cmake/deps.cmake | 12 |
3 files changed, 26 insertions, 15 deletions
diff --git a/cmake/checks.cmake b/cmake/checks.cmake index 62d10d0..64dae58 100644 --- a/cmake/checks.cmake +++ b/cmake/checks.cmake @@ -38,18 +38,20 @@ int main() { check_prototype_definition("get_current_dir_name" "char *get_current_dir_name(void)" "NULL" "unistd.h" HAVE_GET_CURRENT_DIR_NAME) -set(RT_LIBRARY "") -check_symbol_exists("clock_gettime" "time.h" HAVE_CLOCK_GETTIME) +if(NOT DARWIN) + set(RT_LIBRARY "") + check_symbol_exists("clock_gettime" "time.h" HAVE_CLOCK_GETTIME) -if(NOT HAVE_CLOCK_GETTIME) - set(RT_LIBRARY "rt") - list(APPEND CMAKE_REQUIRED_LIBRARIES "rt") + if(NOT HAVE_CLOCK_GETTIME) + set(RT_LIBRARY "rt") + list(APPEND CMAKE_REQUIRED_LIBRARIES "rt") - check_symbol_exists("clock_gettime" "time.h" HAVE_CLOCK_GETTIME_RT) - if(NOT HAVE_CLOCK_GETTIME_RT) + check_symbol_exists("clock_gettime" "time.h" HAVE_CLOCK_GETTIME_RT) + if(NOT HAVE_CLOCK_GETTIME_RT) message(FATAL_ERROR "clock_gettime() not found") - endif(NOT HAVE_CLOCK_GETTIME_RT) -endif(NOT HAVE_CLOCK_GETTIME) + endif(NOT HAVE_CLOCK_GETTIME_RT) + endif(NOT HAVE_CLOCK_GETTIME) +endif(NOT DARWIN) set(CMAKE_EXTRA_INCLUDE_FILES "netinet/if_ether.h") diff --git a/cmake/config.cmake b/cmake/config.cmake index e77abc8..c40ee9f 100644 --- a/cmake/config.cmake +++ b/cmake/config.cmake @@ -4,6 +4,12 @@ else() set(LINUX FALSE) endif() +if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + set(DARWIN TRUE) +else() + set(DARWIN FALSE) +endif() + set(USE_BINDTODEVICE ${LINUX}) set(USE_EPOLL ${LINUX}) @@ -12,6 +18,9 @@ set(USE_PMTU ${LINUX}) set(USE_PKTINFO ${LINUX}) set(USE_PACKET_MARK ${LINUX}) +# OSX doesn't support poll on devices... +set(USE_SELECT ${DARWIN}) + if(${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD") set(USE_MULTIAF_BIND FALSE) else() diff --git a/cmake/deps.cmake b/cmake/deps.cmake index d9dff1e..ea5a0a0 100644 --- a/cmake/deps.cmake +++ b/cmake/deps.cmake @@ -1,11 +1,11 @@ -find_package(BISON 2.5 REQUIRED) +set(PTHREAD_CFLAGS -pthread) + +if(NOT DARWIN) + set(PTHREAD_LDFLAGS -pthread) +endif(NOT DARWIN) -set(CMAKE_THREAD_PREFER_PTHREAD TRUE) -find_package(Threads) -if(NOT CMAKE_USE_PTHREADS_INIT) - MESSAGE(FATAL_ERROR "No pthread support found.") -endif(NOT CMAKE_USE_PTHREADS_INIT) +find_package(BISON 2.5 REQUIRED) find_package(PkgConfig REQUIRED) pkg_check_modules(UECC REQUIRED libuecc>=3) |