Commit Graph

3 Commits

Author SHA1 Message Date
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
Alexandru Croitor
9a9da3aad2 CMake: Handle fuzzer-no-link sanitizer feature name correctly
Pick-to: 6.2
Task-number: QTBUG-87989
Change-Id: Ife42f1fe001c5fafd10981f23dcd387cacc15276
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-06-25 12:33:58 +02:00
Alexandru Croitor
44cce1a2ea CMake: Split QtBuild.cmake into smaller files
QtBuild.cmake is huge. Split it.

Move module, plugin, tools, executables and test related functions out
of QtBuild.cmake into separate files.
Do the same for many other things too.

An additional requirement is that all the new Helpers files only
define functions and macros.
No global variable definitions are allowed, nor execution of commands
with side effects.

Some notes:
qt_install_qml_files is removed because it's dead code.

Some functions still need to be figured out, because they are
interspersed and depend on various global state assignments.

Task-number: QTBUG-86035
Change-Id: I21d79ff02eef923c202eb1000422888727cb0e2c
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-08-14 13:17:11 +02:00