summaryrefslogtreecommitdiff
path: root/expat/ConfigureChecks.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-12-12 11:31:57 -0500
committerBrad King <brad.king@kitware.com>2017-12-13 07:05:46 -0500
commit6b3c44815396d4464c6e5e228eb281a9d206ca54 (patch)
treeb556d190ccbf0d72b0e9be38c2baf2e5eba33763 /expat/ConfigureChecks.cmake
parentcd4b1c49c0f3004e481ad9f767d5185689e5dd2f (diff)
downloadlibexpat-git-6b3c44815396d4464c6e5e228eb281a9d206ca54.tar.gz
CMake: Prefer check_symbol_exists over check_function_exists
The `CheckFunctionExists` module documentation recommends using `CheckSymbolExists` instead. `check_symbol_exists` verifies that one can actually include a header file and refer to a symbol. This is more robust than just checking whether one can link to a symbol by name.
Diffstat (limited to 'expat/ConfigureChecks.cmake')
-rw-r--r--expat/ConfigureChecks.cmake16
1 files changed, 9 insertions, 7 deletions
diff --git a/expat/ConfigureChecks.cmake b/expat/ConfigureChecks.cmake
index d97b3972..dbb49210 100644
--- a/expat/ConfigureChecks.cmake
+++ b/expat/ConfigureChecks.cmake
@@ -2,7 +2,6 @@ include(CheckCCompilerFlag)
include(CheckCSourceCompiles)
include(CheckIncludeFile)
include(CheckIncludeFiles)
-include(CheckFunctionExists)
include(CheckSymbolExists)
include(TestBigEndian)
@@ -18,18 +17,21 @@ check_include_file("sys/stat.h" HAVE_SYS_STAT_H)
check_include_file("sys/types.h" HAVE_SYS_TYPES_H)
check_include_file("unistd.h" HAVE_UNISTD_H)
-check_function_exists("getpagesize" HAVE_GETPAGESIZE)
-check_function_exists("bcopy" HAVE_BCOPY)
+check_symbol_exists("getpagesize" "unistd.h" HAVE_GETPAGESIZE)
+check_symbol_exists("bcopy" "strings.h" HAVE_BCOPY)
check_symbol_exists("memmove" "string.h" HAVE_MEMMOVE)
-check_function_exists("mmap" HAVE_MMAP)
-check_function_exists("getrandom" HAVE_GETRANDOM)
+check_symbol_exists("mmap" "sys/mman.h" HAVE_MMAP)
+check_symbol_exists("getrandom" "sys/random.h" HAVE_GETRANDOM)
if(USE_libbsd)
set(CMAKE_REQUIRED_LIBRARIES "${LIB_BSD}")
+ set(_bsd "bsd/")
+else()
+ set(_bsd "")
endif()
-check_function_exists("arc4random_buf" HAVE_ARC4RANDOM_BUF)
+check_symbol_exists("arc4random_buf" "${_bsd}stdlib.h" HAVE_ARC4RANDOM_BUF)
if(NOT HAVE_ARC4RANDOM_BUF)
- check_function_exists("arc4random" HAVE_ARC4RANDOM)
+ check_symbol_exists("arc4random" "${_bsd}stdlib.h" HAVE_ARC4RANDOM)
endif()
set(CMAKE_REQUIRED_LIBRARIES)