CMake: Use check_symbol_exists instead of check_function_exists

The documentation for the CheckFunctionExists module says that it is
better to use CheckSymbolExists and lists some reasons. For our purpose,
the reason is that check_function_exists is incompatible with -Werror.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2018-07-24 14:47:58 +02:00
parent ef110361dc
commit 7db0188cb2
1 changed files with 4 additions and 4 deletions

View File

@ -158,8 +158,8 @@ set(AWESOME_DEPENDENCIES
pkg_check_modules(AWESOME_REQUIRED REQUIRED ${AWESOME_DEPENDENCIES}) pkg_check_modules(AWESOME_REQUIRED REQUIRED ${AWESOME_DEPENDENCIES})
# Check for backtrace_symbols() # Check for backtrace_symbols()
include(CheckFunctionExists) include(CheckSymbolExists)
check_function_exists(backtrace_symbols HAS_EXECINFO) check_symbol_exists(backtrace_symbols execinfo.h HAS_EXECINFO)
if(NOT HAS_EXECINFO) if(NOT HAS_EXECINFO)
find_library(LIB_EXECINFO execinfo) find_library(LIB_EXECINFO execinfo)
if(LIB_EXECINFO) if(LIB_EXECINFO)
@ -176,11 +176,11 @@ else()
endif() endif()
# Do we need libm for round()? # Do we need libm for round()?
check_function_exists(round HAS_ROUND_WITHOUT_LIBM) check_symbol_exists(round math.h HAS_ROUND_WITHOUT_LIBM)
if(NOT HAS_ROUND_WITHOUT_LIBM) if(NOT HAS_ROUND_WITHOUT_LIBM)
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} m) SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} m)
set(AWESOME_REQUIRED_LDFLAGS ${AWESOME_REQUIRED_LDFLAGS} m) set(AWESOME_REQUIRED_LDFLAGS ${AWESOME_REQUIRED_LDFLAGS} m)
check_function_exists(round HAS_ROUND_WITH_LIBM) check_symbol_exists(round math.h HAS_ROUND_WITH_LIBM)
if(NOT HAS_ROUND_WITH_LIBM) if(NOT HAS_ROUND_WITH_LIBM)
message(FATAL_ERROR "Did not find round()") message(FATAL_ERROR "Did not find round()")
endif() endif()