summaryrefslogtreecommitdiffstats
path: root/cmake/QtTargetHelpers.cmake
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2021-11-29 21:18:43 +0100
committerJoerg Bornemann <joerg.bornemann@qt.io>2021-12-02 12:53:34 +0100
commit75eb08711ef7a51305b4daad411548a2b6b4f8c6 (patch)
tree780ba3b17d526695a72c56d9f0022a64507a0f95 /cmake/QtTargetHelpers.cmake
parent6b02473e1e4b559cb81c007a35a07746d843398c (diff)
Install MSVC debug information for resource object libraries
Building against a static debug MSVC Qt produced LNK4099 warnings (PDB was not found with object file). This was because we did not install the .pdb files for the object libraries that are created for Qt resources. Now, these .pdb files are named like the object library targets and are installed next to the object files. Pick-to: 6.2 Fixes: QTBUG-97699 Change-Id: I7e23f8392b7ac657be1d2fb3b33e051ae2e4d407 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'cmake/QtTargetHelpers.cmake')
-rw-r--r--cmake/QtTargetHelpers.cmake15
1 files changed, 14 insertions, 1 deletions
diff --git a/cmake/QtTargetHelpers.cmake b/cmake/QtTargetHelpers.cmake
index 206f3cb921..b94a4bdae2 100644
--- a/cmake/QtTargetHelpers.cmake
+++ b/cmake/QtTargetHelpers.cmake
@@ -640,7 +640,7 @@ endfunction()
function(qt_internal_set_compile_pdb_names target)
if(MSVC)
get_target_property(target_type ${target} TYPE)
- if(target_type STREQUAL "STATIC_LIBRARY")
+ if(target_type STREQUAL "STATIC_LIBRARY" OR target_type STREQUAL "OBJECT_LIBRARY")
set_target_properties(${target} PROPERTIES COMPILE_PDB_NAME "${INSTALL_CMAKE_NAMESPACE}${target}")
set_target_properties(${target} PROPERTIES COMPILE_PDB_NAME_DEBUG "${INSTALL_CMAKE_NAMESPACE}${target}d")
endif()
@@ -708,6 +708,19 @@ function(qt_internal_install_pdb_files target install_dir_path)
qt_install(FILES "${compile_time_pdb_file_path}"
DESTINATION "${install_dir_path}" OPTIONAL)
+ elseif(target_type STREQUAL "OBJECT_LIBRARY")
+ get_target_property(pdb_dir "${target}" COMPILE_PDB_OUTPUT_DIRECTORY)
+ if(NOT pdb_dir)
+ get_target_property(pdb_dir "${target}" BINARY_DIR)
+ if(QT_GENERATOR_IS_MULTI_CONFIG)
+ qt_path_join(pdb_dir "${pdb_dir}" "$<CONFIG>")
+ endif()
+ endif()
+ set(pdb_name "${INSTALL_CMAKE_NAMESPACE}${target}$<$<CONFIG:Debug>:d>.pdb")
+ qt_path_join(compile_time_pdb_file_path "${pdb_dir}" "${pdb_name}")
+
+ qt_install(FILES "${compile_time_pdb_file_path}"
+ DESTINATION "${install_dir_path}" OPTIONAL)
endif()
endif()
endfunction()