Răsfoiți Sursa

Merge topic 'revert-pdb-compile-filename-setting'

809e387a13 cmGeneratorTarget: Revert "always provide a compile PDB filename"

Acked-by: Kitware Robot <[email protected]>
Merge-request: !11471
Brad King 4 zile în urmă
părinte
comite
37e8c92172

+ 9 - 4
Source/cmGeneratorTarget.cxx

@@ -1313,10 +1313,15 @@ std::string cmGeneratorTarget::GetCompilePDBName(
     return components.prefix + pdbName + ".pdb";
   }
 
-  // Always use a name for the compile-time database.
-  NameComponents const& components =
-    GetFullNameInternalComponents(config, cmStateEnums::RuntimeBinaryArtifact);
-  return cmStrCat(components.prefix, this->GetName(), ".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 "";
 }
 
 std::string cmGeneratorTarget::GetCompilePDBPath(

+ 0 - 8
Tests/MSVCDebugInformationFormat/CMakeLists.txt

@@ -79,11 +79,3 @@ 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")

+ 0 - 15
Tests/MSVCDebugInformationFormat/PdbCompileFileName.c

@@ -1,15 +0,0 @@
-#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;
-}