Fix COMPILE_PDB_NAME when used on an OBJECT library

When `COMPILE_PDB_NAME` is used without `COMPILE_PDB_OUTPUT_DIRECTORY`
we cannot fall back on the link `PDB_OUTPUT_DIRECTORY` for an object
library because it has no link step.

Fixes: #16674
This commit is contained in:
Brad King 2017-02-24 11:19:24 -05:00
parent 6cbad490c2
commit feff52d42c
2 changed files with 2 additions and 1 deletions

View File

@ -1147,7 +1147,7 @@ std::string cmGeneratorTarget::GetCompilePDBPath(
{
std::string dir = this->GetCompilePDBDirectory(config);
std::string name = this->GetCompilePDBName(config);
if (dir.empty() && !name.empty()) {
if (dir.empty() && !name.empty() && this->HaveWellDefinedOutputFiles()) {
dir = this->GetPDBDirectory(config);
}
if (!dir.empty()) {

View File

@ -21,3 +21,4 @@ add_custom_command(
add_library(A OBJECT a1.c a2.c a.cmake)
target_include_directories(A PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
set_property(TARGET A PROPERTY COMPILE_PDB_NAME Apdb)