diff options
author | Jo-Philipp Wich <jo@mein.io> | 2024-04-24 12:46:22 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2024-04-24 12:48:10 +0200 |
commit | a0ad1d127ae6ff14cd54849c72347762a52e200a (patch) | |
tree | d8fcfaa5076998c67271f8a2d4c45b1bf64e500d /CMakeLists.txt | |
parent | 66133685e0088870df4a76acf6faa139b43271d7 (diff) |
build: fix symbol and library detection
Do not unset CMAKE_REQUIRED_* variables in order to allow various
feature tests to work properly with nonstandard locations.
Fixes: #186
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 084c441..1ffcadc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -103,8 +103,8 @@ if(NOT FMOD_FUNCTION_EXISTS) target_link_libraries(libucode m) endif() -set(CMAKE_REQUIRED_INCLUDES ${JSONC_INCLUDE_DIRS}) -set(CMAKE_REQUIRED_LIBRARIES ${JSONC_LINK_LIBRARIES}) +list(APPEND CMAKE_REQUIRED_INCLUDES ${JSONC_INCLUDE_DIRS}) +list(APPEND CMAKE_REQUIRED_LIBRARIES ${JSONC_LINK_LIBRARIES}) check_symbol_exists(json_tokener_get_parse_end "json-c/json.h" HAVE_PARSE_END) if(HAVE_PARSE_END) add_definitions(-DHAVE_PARSE_END) @@ -117,8 +117,6 @@ check_symbol_exists(json_object_new_uint64 "json-c/json.h" HAVE_JSON_UINT64) if(HAVE_JSON_UINT64) add_definitions(-DHAVE_JSON_UINT64) endif() -unset(CMAKE_REQUIRED_INCLUDES) -unset(CMAKE_REQUIRED_LIBRARIES) set(LIBRARIES "") @@ -237,11 +235,10 @@ if(ULOOP_SUPPORT) add_library(uloop_lib MODULE lib/uloop.c) set_target_properties(uloop_lib PROPERTIES OUTPUT_NAME uloop PREFIX "") target_link_options(uloop_lib PRIVATE ${UCODE_MODULE_LINK_OPTIONS}) - set(CMAKE_REQUIRED_LIBRARIES ${libubox}) + list(APPEND CMAKE_REQUIRED_LIBRARIES ${libubox}) check_function_exists(uloop_timeout_remaining64 REMAINING64_FUNCTION_EXISTS) check_function_exists(uloop_interval_set INTERVAL_FUNCTION_EXISTS) check_function_exists(uloop_signal_add SIGNAL_FUNCTION_EXISTS) - unset(CMAKE_REQUIRED_LIBRARIES) if(REMAINING64_FUNCTION_EXISTS) target_compile_definitions(uloop_lib PUBLIC HAVE_ULOOP_TIMEOUT_REMAINING64) endif() |