cmake: make PDB output directory match that of a static library.

PDB files should be created at the same location as their primary
artifact, which is either static library or a DLL.

On Windows, an artifact location is controlled by:

* RUNTIME_OUTPUT_DIRECTORY is a directory of a DLL artifact.
* ARCHIVE_OUTPUT_DIRECTORY is a directory of a LIB artifact.

A PDB file location is controlled:

* PDB_OUTPUT_DIRECTORY should match a directory of a DLL artifact.
* COMPILE_PDB_OUTPUT_DIRECTORY should match a directory of a LIB artifact.
This commit is contained in:
Andrei Polushin 2022-07-11 17:16:58 +07:00
parent bea621c3c3
commit a2d6ee847e

View File

@ -162,7 +162,8 @@ function(cxx_library_with_type name type cxx_flags)
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
# make PDBs match library name
get_target_property(pdb_debug_postfix ${name} DEBUG_POSTFIX)
set_target_properties(${name}