From d4a1a3599b36f37b14422a6c8150f927582f6606 Mon Sep 17 00:00:00 2001 From: Brent Murphy Date: Mon, 22 Jun 2026 18:27:35 +1000 Subject: [PATCH] cmake: Fix PDB output dir for install of static and shared lib PR https://github.com/google/googletest/pull/3940 added COMPILE_PDB_OUTPUT_DIRECTORY without updating the install command to accommodate the two PDB properties. COMPILE_PDB_* and PDB_* properties are two distinct properties that affect static (COMPILE_PDB_*) and shared (PDB_*) separately. This commit adds cmake install rule for both types (optionally) to install when available --- googletest/cmake/internal_utils.cmake | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/googletest/cmake/internal_utils.cmake b/googletest/cmake/internal_utils.cmake index ca76f42d7..5f4e85a8a 100644 --- a/googletest/cmake/internal_utils.cmake +++ b/googletest/cmake/internal_utils.cmake @@ -320,11 +320,15 @@ function(install_project) foreach(t ${ARGN}) get_target_property(t_pdb_name ${t} COMPILE_PDB_NAME) get_target_property(t_pdb_name_debug ${t} COMPILE_PDB_NAME_DEBUG) - get_target_property(t_pdb_output_directory ${t} PDB_OUTPUT_DIRECTORY) + get_target_property(t_pdb_output_directory ${t} COMPILE_PDB_OUTPUT_DIRECTORY) + get_target_property(t_shared_pdb_name ${t} PDB_NAME) + get_target_property(t_shared_pdb_name_debug ${t} PDB_NAME_DEBUG) + get_target_property(t_shared_pdb_output_directory ${t} PDB_OUTPUT_DIRECTORY) install(FILES - "${t_pdb_output_directory}/\${CMAKE_INSTALL_CONFIG_NAME}/$<$:${t_pdb_name_debug}>$<$>:${t_pdb_name}>.pdb" + "$<$,STATIC_LIBRARY>:${t_pdb_output_directory}/\${CMAKE_INSTALL_CONFIG_NAME}/$,${t_pdb_name_debug},${t_pdb_name}>.pdb>" + "$<$,SHARED_LIBRARY>:${t_shared_pdb_output_directory}/\${CMAKE_INSTALL_CONFIG_NAME}/$,${t_shared_pdb_name_debug},${t_shared_pdb_name}>.pdb" COMPONENT "${PROJECT_NAME}" - DESTINATION ${CMAKE_INSTALL_LIBDIR} + DESTINATION $,STATIC_LIBRARY>,${CMAKE_INSTALL_LIBDIR},${CMAKE_INSTALL_BINDIR}> OPTIONAL) endforeach() endif()