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 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> (cherry picked from commit baddc0a1958c8ea9cb946465c93ecdd62bde9d3d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
c2e528ef42
commit
858bb5df19
@ -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()
|
||||
|
@ -168,7 +168,10 @@ function(qt_internal_add_tool target_name)
|
||||
APPEND PROPERTY
|
||||
EXPORT_PROPERTIES "_qt_package_version")
|
||||
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.19.0" AND QT_FEATURE_debug_and_release)
|
||||
get_cmake_property(is_multi_config GENERATOR_IS_MULTI_CONFIG)
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.19.0"
|
||||
AND QT_FEATURE_debug_and_release
|
||||
AND is_multi_config)
|
||||
set_property(TARGET "${target_name}"
|
||||
PROPERTY EXCLUDE_FROM_ALL "$<NOT:$<CONFIG:${QT_MULTI_CONFIG_FIRST_CONFIG}>>")
|
||||
endif()
|
||||
|
Loading…
x
Reference in New Issue
Block a user