summaryrefslogtreecommitdiffstats
path: root/cmake/Qt3rdPartyLibraryHelpers.cmake
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2020-09-22 22:16:20 +0200
committerJoerg Bornemann <joerg.bornemann@qt.io>2020-09-25 17:02:52 +0200
commit893ee163528731375cf2bc5115d73a3e8c018d17 (patch)
tree75fdf6a7b2b195772711864ab050bae32fde0d94 /cmake/Qt3rdPartyLibraryHelpers.cmake
parent1e7a52005b6bc92f78afee28d7e9792a2d3dfc46 (diff)
CMake: Fix build of Release user projects against RelWithDebInfo Qt
Building a user project in Release configuration against a Qt built with CMAKE_CONFIGURATION_TYPES=RelWithDebInfo;Debug led to the user project being linked against the Debug Qt libraries. This is especially painful with MSVC where debug and release runtimes are incompatible. We now create *AdditionalTargetInfo.cmake files along the exported *Targets.cmake files that set the IMPORT_*_<CONFIG> properties to the values of the release config Qt was built with. User projects built with an unknown configuration (CMAKE_BUILD_TYPE=ArbitraryName) will link against a release Qt. This can be controlled by setting the variable QT_DEFAULT_IMPORT_CONFIGURATION to, for example, DEBUG in the user project. Fixes: QTBUG-86743 Change-Id: I12c4b065a9845c7317f6acddab46b649f2732c9e Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake/Qt3rdPartyLibraryHelpers.cmake')
-rw-r--r--cmake/Qt3rdPartyLibraryHelpers.cmake6
1 files changed, 6 insertions, 0 deletions
diff --git a/cmake/Qt3rdPartyLibraryHelpers.cmake b/cmake/Qt3rdPartyLibraryHelpers.cmake
index a593c389f0..41c4ad6fa7 100644
--- a/cmake/Qt3rdPartyLibraryHelpers.cmake
+++ b/cmake/Qt3rdPartyLibraryHelpers.cmake
@@ -232,6 +232,12 @@ function(qt_internal_add_3rdparty_library target)
DESTINATION "${config_install_dir}"
)
+ qt_internal_export_additional_targets_file(
+ TARGETS ${target}
+ EXPORT_NAME_PREFIX ${INSTALL_CMAKE_NAMESPACE}${target}
+ CONFIG_INSTALL_DIR "${config_install_dir}"
+ )
+
qt_internal_export_modern_cmake_config_targets_file(
TARGETS ${target}
EXPORT_NAME_PREFIX ${INSTALL_CMAKE_NAMESPACE}${target}