mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-07 06:09:52 -06:00
Merge topic 'pdb-compile-filename-setting'
1a8712d31a cmGeneratorTarget: always provide a compile PDB filename
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11445
This commit is contained in:
@@ -1313,15 +1313,10 @@ std::string cmGeneratorTarget::GetCompilePDBName(
|
||||
return components.prefix + pdbName + ".pdb";
|
||||
}
|
||||
|
||||
// If the target is PCH-reused, we need a stable name for the PDB file so
|
||||
// that reusing targets can construct a stable name for it.
|
||||
if (this->PchReused) {
|
||||
NameComponents const& components = GetFullNameInternalComponents(
|
||||
config, cmStateEnums::RuntimeBinaryArtifact);
|
||||
return cmStrCat(components.prefix, this->GetName(), ".pdb");
|
||||
}
|
||||
|
||||
return "";
|
||||
// Always use a name for the compile-time database.
|
||||
NameComponents const& components =
|
||||
GetFullNameInternalComponents(config, cmStateEnums::RuntimeBinaryArtifact);
|
||||
return cmStrCat(components.prefix, this->GetName(), ".pdb");
|
||||
}
|
||||
|
||||
std::string cmGeneratorTarget::GetCompilePDBPath(
|
||||
|
||||
@@ -79,3 +79,11 @@ endif()
|
||||
if(CMake_TEST_Fortran)
|
||||
verify(Fortran verify.F90)
|
||||
endif()
|
||||
|
||||
# Issue 27401; 4.2.0 regression
|
||||
add_library(PdbCompileFileName PdbCompileFileName.c)
|
||||
target_compile_definitions(PdbCompileFileName
|
||||
PRIVATE
|
||||
"TARGET_DIRECTORY=\"$<TARGET_INTERMEDIATE_DIR:PdbCompileFileName>\"")
|
||||
set_property(TARGET PdbCompileFileName PROPERTY
|
||||
MSVC_DEBUG_INFORMATION_FORMAT "ProgramDatabase")
|
||||
|
||||
15
Tests/MSVCDebugInformationFormat/PdbCompileFileName.c
Normal file
15
Tests/MSVCDebugInformationFormat/PdbCompileFileName.c
Normal file
@@ -0,0 +1,15 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int ret = 0;
|
||||
char const* fname = TARGET_DIRECTORY "/PdbCompileFileName.pdb";
|
||||
FILE* f = fopen(fname, "r");
|
||||
if (f) {
|
||||
fclose(f);
|
||||
} else {
|
||||
printf("Failed to open PDB file '%s'\n", fname);
|
||||
ret = 1;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
Reference in New Issue
Block a user