2022-07-05 11:26:52 +00:00
|
|
|
# Copyright (C) 2022 The Qt Company Ltd.
|
|
|
|
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
|
|
|
2021-06-24 10:30:32 +00:00
|
|
|
# Computes which sanitizer options should be set based on features evaluated in qtbase.
|
|
|
|
# Sets ECM_ENABLE_SANITIZERS with those options in the function calling scope.
|
|
|
|
function(qt_internal_set_up_sanitizer_options)
|
2020-08-13 15:37:47 +00:00
|
|
|
set(ECM_ENABLE_SANITIZERS "" CACHE STRING "Enable sanitizers")
|
2021-06-24 10:05:29 +00:00
|
|
|
set_property(CACHE ECM_ENABLE_SANITIZERS PROPERTY STRINGS
|
|
|
|
"address;memory;thread;undefined;fuzzer;fuzzer-no-link")
|
2020-08-13 15:37:47 +00:00
|
|
|
|
2021-06-24 10:30:32 +00:00
|
|
|
# If QT_FEATURE_sanitize_foo was enabled, make sure to set the appropriate
|
|
|
|
# ECM_ENABLE_SANITIZERS value.
|
2020-08-13 15:37:47 +00:00
|
|
|
set(enabled_sanitizer_features "")
|
|
|
|
foreach(sanitizer_type address memory thread undefined)
|
2021-06-24 10:30:32 +00:00
|
|
|
if(QT_FEATURE_sanitize_${sanitizer_type})
|
2020-08-13 15:37:47 +00:00
|
|
|
list(APPEND enabled_sanitizer_features "${sanitizer_type}")
|
|
|
|
endif()
|
|
|
|
endforeach()
|
2021-06-24 10:05:29 +00:00
|
|
|
|
|
|
|
# There's a mismatch between fuzzer-no-link ECM option and fuzzer_no_link Qt feature.
|
2021-06-24 10:30:32 +00:00
|
|
|
if(QT_FEATURE_sanitize_fuzzer_no_link)
|
2021-06-24 10:05:29 +00:00
|
|
|
list(APPEND enabled_sanitizer_features "fuzzer-no-link")
|
|
|
|
endif()
|
|
|
|
|
2020-08-13 15:37:47 +00:00
|
|
|
if(enabled_sanitizer_features)
|
2021-06-24 10:30:32 +00:00
|
|
|
set(ECM_ENABLE_SANITIZERS "${enabled_sanitizer_features}" PARENT_SCOPE)
|
2020-08-13 15:37:47 +00:00
|
|
|
endif()
|
|
|
|
endfunction()
|