Skip to content

Commit

Permalink
cmake: replace check_library_exists by check_cxx_symbol_exists
Browse files Browse the repository at this point in the history
As per https://gitlab.kitware.com/cmake/cmake/-/issues/18121,
check_library_exists cannot not determine the availability of a symbol
in a static library. Switch to check_cxx_symbol_exists to avoid
incorrectly detecting the presence of dbghelp.
  • Loading branch information
sergiud committed Dec 20, 2023
1 parent 36ccb15 commit c217f06
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ include (CheckCXXSourceRuns)
include (CheckCXXSymbolExists)
include (CheckFunctionExists)
include (CheckIncludeFileCXX)
include (CheckLibraryExists)
include (CheckStructHasMember)
include (CheckTypeSize)
include (CMakeDependentOption)
Expand Down Expand Up @@ -156,7 +155,10 @@ cmake_pop_check_state ()
# snprintf as an inline function
check_cxx_symbol_exists (snprintf cstdio HAVE_SNPRINTF)

check_library_exists (dbghelp UnDecorateSymbolName "" HAVE_DBGHELP)
cmake_push_check_state (RESET)
set (CMAKE_REQUIRED_LIBRARIES dbghelp)
check_cxx_symbol_exists (UnDecorateSymbolName "windows.h;dbghelp.h" HAVE_DBGHELP)
cmake_pop_check_state ()

check_cxx_source_compiles ("
#include <cstdlib>
Expand Down

0 comments on commit c217f06

Please sign in to comment.