From 93498fff02c5edecff102d895f5cd239cb1504a2 Mon Sep 17 00:00:00 2001 From: Toni Date: Mon, 6 Nov 2023 13:25:49 +0100 Subject: Apple/BSD port (#30) * Add MacOS to Github CI builds. * Fixed libnDPI-4.8 CI build. * Fixed missing include for `struct sockaddr*`. * Reworked IPv4 address and netmask retrieval. Signed-off-by: Toni Uhlig --- CMakeLists.txt | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 73d659a5d..21020d5e7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,6 +31,7 @@ set(CPACK_PACKAGE_VERSION_PATCH 0) include(CPack) include(CheckFunctionExists) +include(CheckLibraryExists) include(CheckEpoll) check_epoll(HAS_EPOLL) @@ -49,14 +50,19 @@ if(NOT MATH_FUNCTION_EXISTS AND NOT NEED_LINKING_AGAINST_LIBM) CHECK_FUNCTION_EXISTS(log2f MATH_FUNCTION_EXISTS) if(NOT MATH_FUNCTION_EXISTS) unset(MATH_FUNCTION_EXISTS CACHE) - list(APPEND CMAKE_REQUIRED_LIBRARIES m) - CHECK_FUNCTION_EXISTS(log2f MATH_FUNCTION_EXISTS) - if(MATH_FUNCTION_EXISTS) - set(NEED_LINKING_AGAINST_LIBM TRUE CACHE BOOL "" FORCE) - else() - message(FATAL_ERROR "Failed making the log2f() function available") - endif() - endif() + list(APPEND CMAKE_REQUIRED_LIBRARIES m) + CHECK_FUNCTION_EXISTS(log2f MATH_FUNCTION_EXISTS) + if(MATH_FUNCTION_EXISTS) + set(NEED_LINKING_AGAINST_LIBM TRUE CACHE BOOL "" FORCE) + else() + check_library_exists(m sqrt "" NEED_LINKING_AGAINST_LIBM) + if(NOT NEED_LINKING_AGAINST_LIBM) + # Was not able to figure out if explicit linkage against libm is required. + # Forcing libm linkage. Good idea? + set(NEED_LINKING_AGAINST_LIBM TRUE CACHE BOOL "" FORCE) + endif() + endif() + endif() endif() if(NEED_LINKING_AGAINST_LIBM) -- cgit v1.2.3