diff options
| author | Alexandru Croitor <alexandru.croitor@qt.io> | 2025-01-07 18:16:29 +0100 |
|---|---|---|
| committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2025-01-21 21:16:42 +0100 |
| commit | baddc0a1958c8ea9cb946465c93ecdd62bde9d3d (patch) | |
| tree | 2133233455c5205f47ab0be567e07a7ade1f49f7 /cmake/QtExecutableHelpers.cmake | |
| parent | 78a46bf16b7061bfd77b7b3bcf392c28ee788bfc (diff) | |
CMake: Build executables in single-config debug-and-release builds
If qtbase is configured with -debug-and-release -force-debug-info,
which maps to '-GNinja Multi-Config'
'-DCMAKE_CONFIGURATION_TYPES=RelWIthDebInfo;Debug'
and then qtopcua is configured with -GNinja -DCMAKE_BUILD_TYPE=Release
building the 'all' target would not build executables or tools.
That's because the targets have their EXCLUDE_FROM_ALL property set to
exclude any non-first multi-config, and Release doesn't match
RelWithDebInfo.
Such a scenario can happen for our multi-config windows builds, when
someone tries to build a repo not with qt-configure-module but rather
with cmake directly. They would then not specify the same build types
or generator, which can happen when opening in an IDE like Qt Creator.
Make sure to also check if the current generator is a multi-config
one, in addition to whether QT_FEATURE_debug_and_release is ON, before
adding the genex to the EXCLUDE_FROM_ALL property.
This allows building and installing executables and tools in such a
scenario, because in a single config build, the genex would not be
added, even if QT_FEATURE_debug_and_release is ON.
Pick-to: 6.8 6.9
Fixes: QTBUG-132609
Task-number: QTBUG-132338
Change-Id: Iaee1a0afb19df97ee1263dbaf27c8e29fc127831
Reviewed-by: Jannis Völker <jannis.voelker@basyskom.com>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Diffstat (limited to 'cmake/QtExecutableHelpers.cmake')
| -rw-r--r-- | cmake/QtExecutableHelpers.cmake | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/cmake/QtExecutableHelpers.cmake b/cmake/QtExecutableHelpers.cmake index 4c96c811e96..608d52437ea 100644 --- a/cmake/QtExecutableHelpers.cmake +++ b/cmake/QtExecutableHelpers.cmake @@ -71,7 +71,12 @@ function(qt_internal_add_executable name) endif() endif() - if(arg_QT_APP AND QT_FEATURE_debug_and_release AND CMAKE_VERSION VERSION_GREATER_EQUAL "3.19.0") + get_cmake_property(is_multi_config GENERATOR_IS_MULTI_CONFIG) + if(arg_QT_APP + AND QT_FEATURE_debug_and_release + AND CMAKE_VERSION VERSION_GREATER_EQUAL "3.19.0" + AND is_multi_config + ) set_property(TARGET "${name}" PROPERTY EXCLUDE_FROM_ALL "$<NOT:$<CONFIG:${QT_MULTI_CONFIG_FIRST_CONFIG}>>") endif() |
