Go to file
Alexandru Croitor 1981682687 CMake: Propagate sanitizer flags to public projects
Ensure that Qt user projects build with sanitizer flags if Qt was
configured with any of the sanitizers enabled.

To compile Qt with sanitizer support enable any of Qt sanitizer
features.

Passing -DECM_ENABLE_SANITIZERS=address to CMake is NOT supported
anymore.

When configuring Qt using CMake directly, pass
    -DFEATURE_sanitizer_address=ON
    -DFEATURE_sanitizer_undefined=ON
instead of
    -DECM_ENABLE_SANITIZERS=address;undefined

When configuring Qt with the configure script pass
    -sanitize address -sanitize undefined
as usual.

QtConfig.cmake now records the sanitizer options that should be
enabled for all consuming projects based on the enabled Qt features.
This applies to internal Qt builds as well as well as tests an
examples.

The recorded sanitizer options are assigned to the ECM_ENABLE_SANITIZERS
variable in the directory scope where find_package(Qt6) is called.
The ECMEnableSanitizers module is included to add the necessary flags to
all targets in that directory scope or its children.

This behavior can be opted out by setting the
QT_NO_ADD_SANITIZER_OPTIONS variable in projects that use Qt and might
be handling sanitizer options differently.

Amends 7e03bc39b8

Pick-to: 6.2
Fixes: QTBUG-87989
Task-number: QTBUG-92083
Change-Id: I2e3371147277bdf8f55a39abaa34478dea4853a6
Reviewed-by: Robert Löhning <robert.loehning@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-06-25 12:33:58 +02:00
.github/workflows Github Actions: many minor updates 2021-01-22 18:48:54 +01:00
bin CMake: Allow usage of QtStandaloneTestTemplateProject as package component 2021-04-23 13:31:04 +02:00
cmake CMake: Propagate sanitizer flags to public projects 2021-06-25 12:33:58 +02:00
coin Increase the timeout for test targets for enforce exit code yaml 2021-06-04 18:16:09 +00:00
config.tests Fix the precompile_header configure test 2021-06-19 01:08:23 +02:00
dist Add Qt 6.0.0 changes file 2020-11-16 10:02:08 +02:00
doc Doc: CSS: Update selectors for target highlighting 2021-06-07 16:44:23 +01:00
examples Qt::PrintSupport is an optional component in the fontsampler example 2021-06-15 22:11:10 +02:00
lib Purge all fonts 2015-08-18 19:59:14 +00:00
libexec Fix invalid path to the qt-cmake.bat when calling qt-internal-configure-tests.bat 2021-06-23 14:26:18 +02:00
mkspecs macOS: Respect QMAKE_APPLE_DEVICE_ARCHS by building for all those archs 2021-06-23 13:43:45 +02:00
qmake Fix QT_HOST_DATA for builds setting INSTALL_MKSPECSDIR 2021-06-23 22:12:41 +02:00
src Schannel: Get rid of Windows < 10 code 2021-06-25 06:01:54 +00:00
tests tst_qsslsocket: detect ALPN support (on server) using supportedFeatures() 2021-06-25 08:01:55 +02:00
util Fix mapping of MultimediaQuick internal module 2021-06-22 14:41:10 +02:00
.cmake.conf Conan: Read status flag from .cmake.conf 2021-06-21 15:19:16 +03:00
.gitattributes Give batch files CRLF line endings 2020-11-04 15:02:29 +00:00
.gitignore .gitignore: Qt Creator files cleanup 2020-09-25 07:50:15 +02:00
.lgtm.yml Skip LGTM analysis for the bootstrap library and tools 2020-07-16 01:04:34 +02:00
.qmake.conf Bump version 2021-02-18 07:20:21 +02:00
.tag Update the git-archive export options 2012-09-07 15:39:31 +02:00
CMakeLists.txt CMake: Fix global 'apk' target to actually build all apks 2021-06-08 22:37:50 +02:00
conanfile.py Conan: simplify Conan recipe 2021-06-21 15:19:16 +03:00
config_help.txt Allow to load -developer-build without configurations into an IDE 2021-05-07 21:06:58 +02:00
configure Remove the -qmake and -cmake configure arguments 2021-03-11 16:39:50 +01:00
configure.bat Remove superfluous variable assignments from configure.bat 2021-03-11 16:39:54 +01:00
configure.cmake Fix the precompile_header configure test 2021-06-19 01:08:23 +02:00
dependencies.yaml Re-add dependencies.yaml now that qt5.git wip/qt6 builds fine 2019-09-18 13:19:31 +02:00
LICENSE.FDL
LICENSE.GPL2 Add new license header templates and license files 2016-01-14 20:43:46 +00:00
LICENSE.GPL3 Add new license header templates and license files 2016-01-14 20:43:46 +00:00
LICENSE.GPL3-EXCEPT Add new license header templates and license files 2016-01-14 20:43:46 +00:00
LICENSE.LGPL3 Add new license header templates and license files 2016-01-14 20:43:46 +00:00
LICENSE.LGPLv3 Remove LICENSE.GPLv3, LICENSE.LGPLv21, LGPL_EXCEPTION.txt 2018-04-16 11:02:14 +00:00
LICENSE.QT-LICENSE-AGREEMENT Update enterprise license agreement v4.2.1 2019-12-18 13:07:19 +02:00
qt_cmdline.cmake CMake: Propagate sanitizer flags to public projects 2021-06-25 12:33:58 +02:00
sync.profile Implement generating of a module cpp export header 2021-06-24 20:40:49 +02:00