diff options
author | Julian Büning <julian.buening@comsys.rwth-aachen.de> | 2023-05-29 18:16:52 +0200 |
---|---|---|
committer | Cristian Cadar <c.cadar@imperial.ac.uk> | 2023-06-05 17:04:19 +0100 |
commit | 5eca7f3cd6c6113f010737016da90454dd1a7602 (patch) | |
tree | a08405c540b0aa9a74405d783e3b5e4e36ae2a44 | |
parent | 58fb505496b0bae75a300f618cd6e7279a460e95 (diff) | |
download | klee-5eca7f3cd6c6113f010737016da90454dd1a7602.tar.gz |
CMake: use check_c_source_compiles() for FSTATAT_PATH_ACCEPTS_NULL
is a bit more convenient and avoids an extra file
-rw-r--r-- | CMakeLists.txt | 23 | ||||
-rw-r--r-- | cmake/fstatat.c | 9 |
2 files changed, 17 insertions, 15 deletions
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 <fcntl.h> + #include <stddef.h> + #include <sys/stat.h> + + 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 diff --git a/cmake/fstatat.c b/cmake/fstatat.c deleted file mode 100644 index 58aa9301..00000000 --- a/cmake/fstatat.c +++ /dev/null @@ -1,9 +0,0 @@ -#include <fcntl.h> -#include <stddef.h> -#include <sys/stat.h> - -int main(void) { - struct stat buf; - #pragma GCC diagnostic error "-Wnonnull" - fstatat(0, NULL, &buf, 0); -} |