Skip to content

Commit 031f7f9

Browse files
committed
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<vs version>.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.
1 parent 1e3bc8d commit 031f7f9

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/CMakeLists.txt

+8
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,14 @@ if(DNNL_LIBRARY_TYPE STREQUAL "STATIC")
215215
target_link_libraries_install(${LIB_PACKAGE_NAME} "${EXTRA_STATIC_LIBS}")
216216
endif()
217217

218+
foreach(object_library IN LISTS LIB_DEPS)
219+
string(REPLACE "$<TARGET_OBJECTS:" "" object_library "${object_library}")
220+
string(REPLACE ">" "" object_library "${object_library}")
221+
222+
# explicitly set compile PDB name as with Ninja, all targets have the same pdb name like vc<vc_ver>.pdb
223+
set_target_properties(${object_library} PROPERTIES COMPILE_PDB_NAME ${object_library})
224+
endforeach()
225+
218226
set(LIB_EXPORT_NAME "${LIB_PACKAGE_NAME}-targets")
219227
install(TARGETS ${LIB_PACKAGE_NAME}
220228
EXPORT "${LIB_EXPORT_NAME}"

0 commit comments

Comments
 (0)