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

View File

@ -27,6 +27,11 @@
set(CMAKE_REQUIRED_QUIET 1) set(CMAKE_REQUIRED_QUIET 1)
include(CheckIncludeFiles) 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) macro(fl_find_header VAR HEADER)
check_include_files("${HEADER}" ${VAR}) check_include_files("${HEADER}" ${VAR})
@ -235,7 +240,9 @@ check_function_exists(setenv HAVE_SETENV)
if(LIB_m AND NOT WIN32) if(LIB_m AND NOT WIN32)
set(CMAKE_REQUIRED_LIBRARIES ${LIB_m}) set(CMAKE_REQUIRED_LIBRARIES ${LIB_m})
endif() endif()
check_function_exists(trunc HAVE_TRUNC)
check_symbol_exists(trunc "math.h" HAVE_TRUNC)
set(CMAKE_REQUIRED_LIBRARIES) set(CMAKE_REQUIRED_LIBRARIES)
if(HAVE_SCANDIR AND NOT HAVE_SCANDIR_POSIX) if(HAVE_SCANDIR AND NOT HAVE_SCANDIR_POSIX)