From 031f7f9c79461040ab906e6874230dbe5af1949b Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Mon, 3 Mar 2025 12:16:21 +0100 Subject: [PATCH] build: explicitly set compile PDB names Cmake: explicitly set compile PDB names for object libraries, because the behavior is different between MSVC and Ninja generators: - MSVC uses target name as default name for compile PDB - Ninja uses vc.pdb When you want to re-distribute such PDB files and move all files into a single folder, in later cases all files will override each other. --- src/CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3f67a2c84b4..08f787c1e99 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -215,6 +215,14 @@ if(DNNL_LIBRARY_TYPE STREQUAL "STATIC") target_link_libraries_install(${LIB_PACKAGE_NAME} "${EXTRA_STATIC_LIBS}") endif() +foreach(object_library IN LISTS LIB_DEPS) + string(REPLACE "$" "" object_library "${object_library}") + + # explicitly set compile PDB name as with Ninja, all targets have the same pdb name like vc.pdb + set_target_properties(${object_library} PROPERTIES COMPILE_PDB_NAME ${object_library}) +endforeach() + set(LIB_EXPORT_NAME "${LIB_PACKAGE_NAME}-targets") install(TARGETS ${LIB_PACKAGE_NAME} EXPORT "${LIB_EXPORT_NAME}"