diff options
author | Andreas Buhr <andreas.buhr@qt.io> | 2020-11-12 17:01:38 +0100 |
---|---|---|
committer | Andreas Buhr <andreas.buhr@qt.io> | 2020-11-14 10:05:20 +0100 |
commit | 1aec96bffdce7e835aa33f01f44269594a955548 (patch) | |
tree | 2e91d39c6fc8f846d5438df2333ddc38bb25b73b | |
parent | bf820bd3e2eb9d7670fa5b5b6e9bc00c5b38d1ba (diff) |
update KDE-ECM CMake modules to include fuzzer sanitizer
Updates one 3rdparty CMake file from
https://github.com/KDE/extra-cmake-modules to include support for
fuzzing.
Task-number: QTBUG-88429
Change-Id: I19e7ed3c5602c34ba4b86e6b0df2ea3047c7c9e6
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
-rw-r--r-- | cmake/3rdparty/extra-cmake-modules/modules/ECMEnableSanitizers.cmake | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/cmake/3rdparty/extra-cmake-modules/modules/ECMEnableSanitizers.cmake b/cmake/3rdparty/extra-cmake-modules/modules/ECMEnableSanitizers.cmake index e7bffe15c1..4c43e99b6b 100644 --- a/cmake/3rdparty/extra-cmake-modules/modules/ECMEnableSanitizers.cmake +++ b/cmake/3rdparty/extra-cmake-modules/modules/ECMEnableSanitizers.cmake @@ -40,6 +40,8 @@ # - thread # - leak # - undefined +# - fuzzer-no-link +# - fuzzer # # The sanitizers "address", "memory" and "thread" are mutually exclusive. You # cannot enable two of them in the same build. @@ -140,6 +142,13 @@ macro (enable_sanitizer_flags sanitize_option) elseif (${sanitize_option} MATCHES "undefined") check_compiler_version("4.9" "3.1") set(XSAN_COMPILE_FLAGS "-fsanitize=undefined -fsanitize=float-divide-by-zero -fno-omit-frame-pointer -fno-optimize-sibling-calls") + elseif (${sanitize_option} MATCHES "fuzzer-no-link") + check_compiler_version("99.99" "6.0") + set(XSAN_COMPILE_FLAGS "-fsanitize=fuzzer-no-link") + set(XSAN_LINKER_FLAGS "-fsanitize=fuzzer-no-link") + elseif (${sanitize_option} MATCHES "fuzzer") + check_compiler_version("99.99" "6.0") + set(XSAN_COMPILE_FLAGS "-fsanitize=fuzzer") else () message(FATAL_ERROR "Compiler sanitizer option \"${sanitize_option}\" not supported.") endif () @@ -161,7 +170,7 @@ if (ECM_ENABLE_SANITIZERS) if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") link_libraries(${XSAN_LINKER_FLAGS}) endif() - if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") string(REPLACE "-Wl,--no-undefined" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}") string(REPLACE "-Wl,--no-undefined" "" CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}") endif () |