diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2020-11-06 21:48:08 +0100 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2020-11-10 04:24:28 +0100 |
commit | 5b136abd21803988f96b9b66c992822efbef97ec (patch) | |
tree | b5266a5ba068f93bf57dc78ba744535dd6630a3f /cmake/QtToolHelpers.cmake | |
parent | b8b75cdcfa71189c7726607be7b66d0ddeaae372 (diff) |
CMake: Fix installation errors in multi-config build
In multi-config builds (which equals the debug-and-release feature) we
exclude tools of the non-main configurations from the default build.
But we still create installation rules for them. Mark those as optional
to avoid "cmake --install" yielding errors if those tools weren't built.
Fixes: QTBUG-85411
Change-Id: Ic2d3897d1a1c28a715d9a024ec8606fff00e0315
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake/QtToolHelpers.cmake')
-rw-r--r-- | cmake/QtToolHelpers.cmake | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/cmake/QtToolHelpers.cmake b/cmake/QtToolHelpers.cmake index a54fbfa3de..3d9d53c49b 100644 --- a/cmake/QtToolHelpers.cmake +++ b/cmake/QtToolHelpers.cmake @@ -195,8 +195,18 @@ function(qt_internal_add_tool target_name) OUT_VAR install_targets_default_args CMAKE_CONFIG "${cmake_config}" ALL_CMAKE_CONFIGS "${cmake_configs}") + + # Make installation optional for targets that are not built by default in this config + if(QT_FEATURE_debug_and_release + AND NOT (cmake_config STREQUAL QT_MULTI_CONFIG_FIRST_CONFIG)) + set(install_optional_arg OPTIONAL) + else() + unset(install_optional_arg) + endif() + qt_install(TARGETS "${target_name}" ${install_initial_call_args} + ${install_optional_arg} CONFIGURATIONS ${cmake_config} ${install_targets_default_args}) unset(install_initial_call_args) |