diff options
author | Li Xinwei <1326710505@qq.com> | 2020-11-13 17:27:12 +0800 |
---|---|---|
committer | Li Xinwei <1326710505@qq.com> | 2020-11-14 01:05:08 +0800 |
commit | 215400e153b6017ae33aadfa7a319c6daeed4f85 (patch) | |
tree | 1523d3ad47ccbaed71c7dde0d213697da207d3ec /cmake/QtTargetHelpers.cmake | |
parent | 654156fb7907549a79ad76cf56572b25347deb14 (diff) |
CMake: Install pdb files to proper directories in multi-config build
In multi-config build, for different configs, the pdb files of EXEs
should have different installation directories.
For example, when CMAKE_CONFIGURATION_TYPES=RelWithDebInfo;Debug,
<build_dir>/bin/moc.pdb will be installed to <install_dir>/bin/moc.pdb.
<build_dir>/bin/Debug/moc.pdb should be installed to
<install_dir>/bin/Debug/moc.pdb, not <install_dir>/bin/moc.pdb.
Fixes: QTBUG-88268
Change-Id: Idc7c92ca8d44bb81d990656af2b309306a4f5c6b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake/QtTargetHelpers.cmake')
-rw-r--r-- | cmake/QtTargetHelpers.cmake | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/cmake/QtTargetHelpers.cmake b/cmake/QtTargetHelpers.cmake index fcbb3ab1f2..1d1ab7091a 100644 --- a/cmake/QtTargetHelpers.cmake +++ b/cmake/QtTargetHelpers.cmake @@ -554,8 +554,22 @@ function(qt_internal_install_pdb_files target install_dir_path) if(MSVC) get_target_property(target_type ${target} TYPE) - if(target_type STREQUAL "SHARED_LIBRARY" - OR target_type STREQUAL "EXECUTABLE" + if(target_type STREQUAL "EXECUTABLE") + qt_get_cmake_configurations(cmake_configs) + list(LENGTH cmake_configs all_configs_count) + list(GET cmake_configs 0 first_config) + foreach(cmake_config ${cmake_configs}) + set(suffix "") + if(all_configs_count GREATER 1 AND NOT cmake_config STREQUAL first_config) + set(suffix "/${cmake_config}") + endif() + qt_install(FILES "$<TARGET_PDB_FILE:${target}>" + CONFIGURATIONS ${cmake_config} + DESTINATION "${install_dir_path}${suffix}" + OPTIONAL) + endforeach() + + elseif(target_type STREQUAL "SHARED_LIBRARY" OR target_type STREQUAL "MODULE_LIBRARY") qt_install(FILES "$<TARGET_PDB_FILE:${target}>" DESTINATION "${install_dir_path}" |