From 5eca7f3cd6c6113f010737016da90454dd1a7602 Mon Sep 17 00:00:00 2001 From: Julian Büning Date: Mon, 29 May 2023 18:16:52 +0200 Subject: CMake: use check_c_source_compiles() for FSTATAT_PATH_ACCEPTS_NULL is a bit more convenient and avoids an extra file --- CMakeLists.txt | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 552d431a..43fd3edb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -99,13 +99,14 @@ option(KLEE_ENABLE_TIMESTAMP "Add timestamps to KLEE sources" OFF) # Include useful CMake functions ################################################################################ include(GNUInstallDirs) +include(CheckCSourceCompiles) include(CheckCXXSymbolExists) +include(CheckFunctionExists) include(CheckIncludeFile) include(CheckIncludeFileCXX) +include(CheckLibraryExists) include(CheckPrototypeDefinition) include(CMakePushCheckState) -include(CheckFunctionExists) -include(CheckLibraryExists) ################################################################################ # Find LLVM @@ -394,10 +395,20 @@ else() set(HAVE_SELINUX 0) endif() -try_compile (FSTATAT_PATH_ACCEPTS_NULL - ${CMAKE_BINARY_DIR} - ${PROJECT_SOURCE_DIR}/cmake/fstatat.c -) +cmake_push_check_state() +check_c_source_compiles(" + #include + #include + #include + + int main(void) { + struct stat buf; + #pragma GCC diagnostic error \"-Wnonnull\" + fstatat(0, NULL, &buf, 0); + } + " + FSTATAT_PATH_ACCEPTS_NULL) +cmake_pop_check_state() ################################################################################ # KLEE runtime support -- cgit 1.4.1