From 215400e153b6017ae33aadfa7a319c6daeed4f85 Mon Sep 17 00:00:00 2001 From: Li Xinwei <1326710505@qq.com> Date: Fri, 13 Nov 2020 17:27:12 +0800 Subject: 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, /bin/moc.pdb will be installed to /bin/moc.pdb. /bin/Debug/moc.pdb should be installed to /bin/Debug/moc.pdb, not /bin/moc.pdb. Fixes: QTBUG-88268 Change-Id: Idc7c92ca8d44bb81d990656af2b309306a4f5c6b Reviewed-by: Alexandru Croitor --- cmake/QtTargetHelpers.cmake | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'cmake') 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 "$" + 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 "$" DESTINATION "${install_dir_path}" -- cgit v1.2.3