diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2022-04-23 00:21:45 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2022-04-23 00:21:45 +0300 |
commit | fd4e5799f89efa0a2bb1fe1bfc8fd9b80dbc90bd (patch) | |
tree | 26bb2e0e1f44d8b16a4e1335ddfd600d463f2a3c /CMakeLists.txt | |
parent | 1674c2208c4ac6d10b41759cee2690d9ca16dd64 (diff) | |
download | bdwgc-fd4e5799f89efa0a2bb1fe1bfc8fd9b80dbc90bd.tar.gz |
Fix pthread_setname_np and dladdr detection by CMake
(fix of commits 3a8028ff2, ecd488e02)
check_c_source_compiles() compiles and links the provided code snippet
(contrary to AC_COMPILE_IFELSE() in configure); the linking of the
checked code is now suppressed by adding "-c" to CMAKE_REQUIRED_FLAGS.
* CMakeLists.txt (CMAKE_REQUIRED_FLAGS): Set to "-c"; add comment.
* CMakeLists.txt [!BORLAND && !MSVC && !WATCOM && HAVE_FLAG_WERROR]
(CMAKE_REQUIRED_FLAGS): Append "-Werror" instead of overwriting the
value.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 57a17a17..5dce9942 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -380,12 +380,16 @@ if (MSVC) set(SRC ${SRC} extra/msvc_dbg.c) endif() +# Instruct check_c_source_compiles to skip linking. +# Alternatively, we could set CMAKE_REQUIRED_LIBRARIES properly. +SET(CMAKE_REQUIRED_FLAGS "-c") + # Instruct check_c_source_compiles and similar CMake checks not to ignore # compiler warnings (like "implicit declaration of function"). if (NOT BORLAND AND NOT MSVC AND NOT WATCOM) check_c_compiler_flag(-Werror HAVE_FLAG_WERROR) if (HAVE_FLAG_WERROR) - SET(CMAKE_REQUIRED_FLAGS "-Werror") + SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror") endif(HAVE_FLAG_WERROR) endif() |