diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2021-11-06 16:38:57 -0400 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2021-11-09 15:17:19 +0000 |
commit | 537ffaaa8d7dcd0ace3b1cb9218708a8a4d10ca3 (patch) | |
tree | 948b2555d1bdbced5db2adf4a3ee4f1623e74ef3 | |
parent | c91d3d699fc6ffed2abd3146186831dcc863545d (diff) | |
download | libgit2-537ffaaa8d7dcd0ace3b1cb9218708a8a4d10ca3.tar.gz |
cmake: move fuzzer args to the fuzzer's cmake
-rw-r--r-- | CMakeLists.txt | 17 | ||||
-rw-r--r-- | fuzzers/CMakeLists.txt | 3 |
2 files changed, 5 insertions, 15 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index f7a653725..fc742124c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -113,14 +113,6 @@ else() # that uses CMAKE_CONFIGURATION_TYPES and not CMAKE_BUILD_TYPE endif() -IF(BUILD_FUZZERS AND NOT USE_STANDALONE_FUZZERS) - # The actual sanitizer link target will be added when linking the fuzz - # targets. - set(CMAKE_REQUIRED_FLAGS "-fsanitize=fuzzer-no-link") - add_c_flag(-fsanitize=fuzzer-no-link) - unset(CMAKE_REQUIRED_FLAGS) -endif() - # # Subdirectories # @@ -137,13 +129,8 @@ if(BUILD_EXAMPLES) endif() if(BUILD_FUZZERS) - if(NOT USE_STANDALONE_FUZZERS) - if(BUILD_EXAMPLES) - message(FATAL_ERROR "Cannot build the fuzzer targets and the examples together") - endif() - if(BUILD_TESTS) - message(FATAL_ERROR "Cannot build the fuzzer targets and the tests together") - endif() + if((BUILD_TESTS OR BUILD_EXAMPLES) AND NOT USE_STANDALONE_FUZZERS) + message(FATAL_ERROR "Cannot build the fuzzer and the tests or examples together") endif() add_subdirectory(fuzzers) endif() diff --git a/fuzzers/CMakeLists.txt b/fuzzers/CMakeLists.txt index 8cc61b751..1479a2af8 100644 --- a/fuzzers/CMakeLists.txt +++ b/fuzzers/CMakeLists.txt @@ -3,7 +3,10 @@ include_directories(${LIBGIT2_INCLUDES}) include_directories(SYSTEM ${LIBGIT2_SYSTEM_INCLUDES}) if(BUILD_FUZZERS AND NOT USE_STANDALONE_FUZZERS) + set(CMAKE_REQUIRED_FLAGS "-fsanitize=fuzzer-no-link") add_c_flag(-fsanitize=fuzzer) + add_c_flag(-fsanitize=fuzzer-no-link) + unset(CMAKE_REQUIRED_FLAGS) endif() file(GLOB SRC_FUZZ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *_fuzzer.c) |