diff options
author | Toni <matzeton@googlemail.com> | 2023-11-06 13:25:49 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-06 13:25:49 +0100 |
commit | 93498fff02c5edecff102d895f5cd239cb1504a2 (patch) | |
tree | 950b8c4da0b3af990690fee16cce17421a32b3b9 /CMakeLists.txt | |
parent | 1b679271693a17ce0b653b9ba45db77b731db42e (diff) |
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 <matzeton@googlemail.com>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 22 |
1 files changed, 14 insertions, 8 deletions
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) |