CMake: replace check_function_exists() for trunc() (#1049)

Part 1: replace the check for trunc() with check_symbol_exists().

Part 2 (to be done): replace all occurrences of the macro
  check_function_exists() with check_symbol_exists() if possible.
This commit is contained in:
Albrecht Schlosser 2024-08-25 17:45:42 +02:00
parent fc57a51836
commit 67e0547bf9
1 changed files with 8 additions and 1 deletions

View File

@ -27,6 +27,11 @@
set(CMAKE_REQUIRED_QUIET 1)
include(CheckIncludeFiles)
include(CheckSymbolExists)
# FIXME: replace check_function_exists() with check_symbol_exists()
# FIXME: ... and remove the next line when done (Issue #1049)
include(CheckFunctionExists)
macro(fl_find_header VAR HEADER)
check_include_files("${HEADER}" ${VAR})
@ -235,7 +240,9 @@ check_function_exists(setenv HAVE_SETENV)
if(LIB_m AND NOT WIN32)
set(CMAKE_REQUIRED_LIBRARIES ${LIB_m})
endif()
check_function_exists(trunc HAVE_TRUNC)
check_symbol_exists(trunc "math.h" HAVE_TRUNC)
set(CMAKE_REQUIRED_LIBRARIES)
if(HAVE_SCANDIR AND NOT HAVE_SCANDIR_POSIX)