[cmake-commits] king committed cmInstallTargetGenerator.cxx 1.24 1.25 cmLocalUnixMakefileGenerator3.cxx 1.184 1.185 cmLocalVisualStudio7Generator.cxx 1.159 1.160 cmLocalVisualStudio7Generator.h 1.29 1.30 cmMakefileExecutableTargetGenerator.cxx 1.23 1.24 cmMakefileLibraryTargetGenerator.cxx 1.29 1.30 cmTarget.cxx 1.117 1.118 cmTarget.h 1.67 1.68

cmake-commits at cmake.org cmake-commits at cmake.org
Thu Feb 1 09:57:26 EST 2007


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv2420/Source

Modified Files:
	cmInstallTargetGenerator.cxx cmLocalUnixMakefileGenerator3.cxx 
	cmLocalVisualStudio7Generator.cxx 
	cmLocalVisualStudio7Generator.h 
	cmMakefileExecutableTargetGenerator.cxx 
	cmMakefileLibraryTargetGenerator.cxx cmTarget.cxx cmTarget.h 
Log Message:
BUG: The .pdb file generated for a library or executable should match the real file name used for the target.  This addresses bug#3277.


Index: cmLocalVisualStudio7Generator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalVisualStudio7Generator.cxx,v
retrieving revision 1.159
retrieving revision 1.160
diff -u -d -r1.159 -r1.160
--- cmLocalVisualStudio7Generator.cxx	31 Jan 2007 18:34:18 -0000	1.159
+++ cmLocalVisualStudio7Generator.cxx	1 Feb 2007 14:57:24 -0000	1.160
@@ -568,9 +568,32 @@
     flagMap.find("DebugInformationFormat");
   if(mi != flagMap.end() && mi->second != "1")
     {
-    fout <<  "\t\t\t\tProgramDataBaseFileName=\""
-         << this->LibraryOutputPath
-         << "$(OutDir)/" << libName << ".pdb\"\n";
+    if(target.GetType() == cmTarget::EXECUTABLE)
+      {
+      std::string targetName;
+      std::string targetNameFull;
+      std::string targetNamePDB;
+      target.GetExecutableNames(targetName, targetNameFull,
+                                targetNamePDB, configName);
+      fout <<  "\t\t\t\tProgramDataBaseFileName=\""
+           << this->ExecutableOutputPath
+           << "$(OutDir)/" << targetNamePDB << "\"\n";
+      }
+    else if(target.GetType() == cmTarget::STATIC_LIBRARY ||
+            target.GetType() == cmTarget::SHARED_LIBRARY ||
+            target.GetType() == cmTarget::MODULE_LIBRARY)
+      {
+      std::string targetName;
+      std::string targetNameSO;
+      std::string targetNameFull;
+      std::string targetNameImport;
+      std::string targetNamePDB;
+      target.GetLibraryNames(targetName, targetNameSO, targetNameFull,
+                             targetNameImport, targetNamePDB, configName);
+      fout <<  "\t\t\t\tProgramDataBaseFileName=\""
+           << this->LibraryOutputPath
+           << "$(OutDir)/" << targetNamePDB << "\"\n";
+      }
     }
   fout << "/>\n";  // end of <Tool Name=VCCLCompilerTool
   fout << "\t\t\t<Tool\n\t\t\t\tName=\"VCCustomBuildTool\"/>\n";
@@ -625,7 +648,7 @@
     }
 
   this->OutputTargetRules(fout, target, libName);
-  this->OutputBuildTool(fout, configName, libName, target);
+  this->OutputBuildTool(fout, configName, target);
   fout << "\t\t</Configuration>\n";
 }
 void cmLocalVisualStudio7Generator::ReplaceFlagSetMap(std::string& flags, 
@@ -725,10 +748,8 @@
 
 void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
                                                     const char* configName,
-                                                    const char *libName,
                                                     cmTarget &target)
 {
-  std::string targetFullName = target.GetFullName(configName);
   std::string temp;
   std::string extraLinkOptions;
   if(target.GetType() == cmTarget::EXECUTABLE)
@@ -776,8 +797,9 @@
     {
     case cmTarget::STATIC_LIBRARY:
     {
+    std::string targetNameFull = target.GetFullName(configName);
     std::string libpath = this->LibraryOutputPath +
-      "$(OutDir)/" + targetFullName;
+      "$(OutDir)/" + targetNameFull;
     fout << "\t\t\t<Tool\n"
          << "\t\t\t\tName=\"VCLibrarianTool\"\n";
     if(const char* libflags = target.GetProperty("STATIC_LIBRARY_FLAGS"))
@@ -791,6 +813,25 @@
     case cmTarget::SHARED_LIBRARY:
     case cmTarget::MODULE_LIBRARY:
     {
+    std::string targetName;
+    std::string targetNameSO;
+    std::string targetNameFull;
+    std::string targetNameImport;
+    std::string targetNamePDB;
+    target.GetLibraryNames(targetName, targetNameSO, targetNameFull,
+                           targetNameImport, targetNamePDB, configName);
+
+    // VS does not distinguish between shared libraries and module
+    // libraries so it still wants to be given the name of an import
+    // library for modules.
+    if(targetNameImport.empty() &&
+       target.GetType() == cmTarget::MODULE_LIBRARY)
+      {
+      targetNameImport =
+        cmSystemTools::GetFilenameWithoutLastExtension(targetNameFull);
+      targetNameImport += ".lib";
+      }
+
     // Compute the link library and directory information.
     std::vector<cmStdString> linkLibs;
     std::vector<cmStdString> linkDirs;
@@ -832,7 +873,7 @@
     temp = this->LibraryOutputPath;
     temp += configName;
     temp += "/";
-    temp += targetFullName;
+    temp += targetNameFull;
     fout << "\t\t\t\tOutputFile=\""
          << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n";
     this->WriteTargetVersionAttribute(fout, target);
@@ -847,8 +888,7 @@
     this->OutputModuleDefinitionFile(fout, target);
     temp = this->LibraryOutputPath;
     temp += "$(OutDir)/";
-    temp += libName;
-    temp += ".pdb";
+    temp += targetNamePDB;
     fout << "\t\t\t\tProgramDataBaseFile=\"" <<
       this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n";
     if(strcmp(configName, "Debug") == 0
@@ -867,15 +907,19 @@
     temp = this->LibraryOutputPath;
     temp += configName;
     temp += "/";
-    temp += 
-      cmSystemTools::GetFilenameWithoutLastExtension(targetFullName.c_str());
-    temp += ".lib";
-    fout << "\t\t\t\tImportLibrary=\"" 
+    temp += targetNameImport;
+    fout << "\t\t\t\tImportLibrary=\""
          << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"/>\n";
     }
     break;
     case cmTarget::EXECUTABLE:
     {
+    std::string targetName;
+    std::string targetNameFull;
+    std::string targetNamePDB;
+    target.GetExecutableNames(targetName, targetNameFull,
+                              targetNamePDB, configName);
+
     // Compute the link library and directory information.
     std::vector<cmStdString> linkLibs;
     std::vector<cmStdString> linkDirs;
@@ -917,7 +961,7 @@
     temp = this->ExecutableOutputPath;
     temp += configName;
     temp += "/";
-    temp += targetFullName;
+    temp += targetNameFull;
     fout << "\t\t\t\tOutputFile=\"" 
          << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n";
     this->WriteTargetVersionAttribute(fout, target);
@@ -929,8 +973,8 @@
     fout << "\t\t\t\tAdditionalLibraryDirectories=\"";
     this->OutputLibraryDirectories(fout, linkDirs);
     fout << "\"\n";
-    fout << "\t\t\t\tProgramDataBaseFile=\"" << this->LibraryOutputPath
-         << "$(OutDir)\\" << libName << ".pdb\"\n";
+    fout << "\t\t\t\tProgramDataBaseFile=\"" << this->ExecutableOutputPath
+         << "$(OutDir)\\" << targetNamePDB << "\"\n";
     if(strcmp(configName, "Debug") == 0
        || strcmp(configName, "RelWithDebInfo") == 0)
       {

Index: cmLocalVisualStudio7Generator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalVisualStudio7Generator.h,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- cmLocalVisualStudio7Generator.h	31 Jan 2007 18:34:18 -0000	1.29
+++ cmLocalVisualStudio7Generator.h	1 Feb 2007 14:57:24 -0000	1.30
@@ -101,7 +101,7 @@
   void OutputTargetRules(std::ostream& fout, cmTarget &target, 
                          const char *libName);
   void OutputBuildTool(std::ostream& fout, const char* configName,
-                       const char* libname, cmTarget& t);
+                       cmTarget& t);
   void OutputLibraries(std::ostream& fout,
                        std::vector<cmStdString> const& libs);
   void OutputLibraryDirectories(std::ostream& fout,

Index: cmMakefileLibraryTargetGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefileLibraryTargetGenerator.cxx,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- cmMakefileLibraryTargetGenerator.cxx	14 Dec 2006 19:30:16 -0000	1.29
+++ cmMakefileLibraryTargetGenerator.cxx	1 Feb 2007 14:57:24 -0000	1.30
@@ -239,8 +239,9 @@
   std::string targetNameSO;
   std::string targetNameReal;
   std::string targetNameImport;
+  std::string targetNamePDB;
   this->Target->GetLibraryNames(
-    targetName, targetNameSO, targetNameReal, targetNameImport,
+    targetName, targetNameSO, targetNameReal, targetNameImport, targetNamePDB,
     this->LocalGenerator->ConfigurationName.c_str());
 
   // Construct the full path version of the names.
@@ -259,8 +260,7 @@
     outpath += "/";
     }
   std::string targetFullPath = outpath + targetName;
-  std::string targetFullPathPDB = 
-    outpath + this->Target->GetName() + std::string(".pdb");
+  std::string targetFullPathPDB = outpath + targetNamePDB;
   std::string targetFullPathSO = outpath + targetNameSO;
   std::string targetFullPathReal = outpath + targetNameReal;
   std::string targetFullPathImport = outpath + targetNameImport;
@@ -351,18 +351,21 @@
     std::string cleanSharedSOName;
     std::string cleanSharedRealName;
     std::string cleanImportName;
+    std::string cleanPDBName;
     this->Target->GetLibraryCleanNames(
       cleanStaticName,
       cleanSharedName,
       cleanSharedSOName,
       cleanSharedRealName,
       cleanImportName,
+      cleanPDBName,
       this->LocalGenerator->ConfigurationName.c_str());
     std::string cleanFullStaticName = outpath + cleanStaticName;
     std::string cleanFullSharedName = outpath + cleanSharedName;
     std::string cleanFullSharedSOName = outpath + cleanSharedSOName;
     std::string cleanFullSharedRealName = outpath + cleanSharedRealName;
     std::string cleanFullImportName = outpath + cleanImportName;
+    std::string cleanFullPDBName = outpath + cleanPDBName;
     libCleanFiles.push_back
       (this->Convert(cleanFullStaticName.c_str(),
                      cmLocalGenerator::START_OUTPUT,
@@ -398,6 +401,10 @@
           cmLocalGenerator::START_OUTPUT,
           cmLocalGenerator::UNCHANGED));
       }
+    libCleanFiles.push_back
+      (this->Convert(cleanFullPDBName.c_str(),
+                     cmLocalGenerator::START_OUTPUT,
+                     cmLocalGenerator::UNCHANGED));
     }
 
 #ifdef _WIN32

Index: cmTarget.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTarget.h,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -d -r1.67 -r1.68
--- cmTarget.h	7 Dec 2006 14:44:45 -0000	1.67
+++ cmTarget.h	1 Feb 2007 14:57:24 -0000	1.68
@@ -215,7 +215,7 @@
       should be called only on a library target.  */
   void GetLibraryNames(std::string& name, std::string& soName,
                        std::string& realName, std::string& impName,
-                       const char* config);
+                       std::string& pdbName, const char* config);
 
   /** Get the names of the library used to remove existing copies of
       the library from the build tree either before linking or during
@@ -226,20 +226,21 @@
                             std::string& sharedSOName,
                             std::string& sharedRealName,
                             std::string& importName,
+                            std::string& pdbName,
                             const char* config);
 
   /** Get the names of the executable needed to generate a build rule
       that takes into account executable version numbers.  This should
       be called only on an executable target.  */
   void GetExecutableNames(std::string& name, std::string& realName,
-                          const char* config);
+                          std::string& pdbName, const char* config);
 
   /** Get the names of the executable used to remove existing copies
       of the executable from the build tree either before linking or
       during a clean step.  This should be called only on an
       executable target.  */
   void GetExecutableCleanNames(std::string& name, std::string& realName,
-                               const char* config);
+                               std::string& pdbName, const char* config);
 
   /**
    * Compute whether this target must be relinked before installing.
@@ -319,10 +320,12 @@
                                std::string& soName,
                                std::string& realName,
                                std::string& impName,
+                               std::string& pdbName,
                                TargetType type,
                                const char* config);
   void GetExecutableNamesInternal(std::string& name,
                                   std::string& realName,
+                                  std::string& pdbName,
                                   TargetType type,
                                   const char* config);
 

Index: cmMakefileExecutableTargetGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefileExecutableTargetGenerator.cxx,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- cmMakefileExecutableTargetGenerator.cxx	14 Dec 2006 19:30:16 -0000	1.23
+++ cmMakefileExecutableTargetGenerator.cxx	1 Feb 2007 14:57:24 -0000	1.24
@@ -110,8 +110,9 @@
   // Get the name of the executable to generate.
   std::string targetName;
   std::string targetNameReal;
+  std::string targetNamePDB;
   this->Target->GetExecutableNames
-    (targetName, targetNameReal,
+    (targetName, targetNameReal, targetNamePDB,
      this->LocalGenerator->ConfigurationName.c_str());
 
   // Construct the full path version of the names.
@@ -187,8 +188,7 @@
     }
   std::string targetFullPath = outpath + targetName;
   std::string targetFullPathReal = outpath + targetNameReal;
-  std::string targetFullPathPDB = outpath + this->Target->GetName();
-  targetFullPathPDB += ".pdb";
+  std::string targetFullPathPDB = outpath + targetNamePDB;
   std::string targetOutPathPDB = 
     this->Convert(targetFullPathPDB.c_str(),
                   cmLocalGenerator::FULL,
@@ -269,12 +269,14 @@
   {
   std::string cleanName;
   std::string cleanRealName;
+  std::string cleanPDBName;
   this->Target->GetExecutableCleanNames
-    (cleanName, cleanRealName,
+    (cleanName, cleanRealName, cleanPDBName,
      this->LocalGenerator->ConfigurationName.c_str());
 
   std::string cleanFullName = outpath + cleanName;
   std::string cleanFullRealName = outpath + cleanRealName;
+  std::string cleanFullPDBName = outpath + cleanPDBName;
   exeCleanFiles.push_back(this->Convert(cleanFullName.c_str(),
                                         cmLocalGenerator::START_OUTPUT,
                                         cmLocalGenerator::UNCHANGED));
@@ -291,6 +293,9 @@
                                           cmLocalGenerator::START_OUTPUT,
                                           cmLocalGenerator::UNCHANGED));
     }
+  exeCleanFiles.push_back(this->Convert(cleanPDBName.c_str(),
+                                        cmLocalGenerator::START_OUTPUT,
+                                        cmLocalGenerator::UNCHANGED));
   }
 
   // Add a command to remove any existing files for this executable.

Index: cmLocalUnixMakefileGenerator3.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalUnixMakefileGenerator3.cxx,v
retrieving revision 1.184
retrieving revision 1.185
diff -u -d -r1.184 -r1.185
--- cmLocalUnixMakefileGenerator3.cxx	29 Nov 2006 20:59:15 -0000	1.184
+++ cmLocalUnixMakefileGenerator3.cxx	1 Feb 2007 14:57:24 -0000	1.185
@@ -1691,8 +1691,9 @@
     objectName = cmSystemTools::GetFilenameName(objectName.c_str());
     std::string targetName;
     std::string targetNameReal;
+    std::string targetNamePDB;
     target.GetExecutableNames(targetName, targetNameReal,
-                                   this->ConfigurationName.c_str());
+                              targetNamePDB, this->ConfigurationName.c_str());
     if ( target.GetPropertyAsBool("MACOSX_BUNDLE") )
       {
       // Construct the full path version of the names.

Index: cmInstallTargetGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmInstallTargetGenerator.cxx,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- cmInstallTargetGenerator.cxx	31 Oct 2006 19:28:48 -0000	1.24
+++ cmInstallTargetGenerator.cxx	1 Feb 2007 14:57:24 -0000	1.25
@@ -208,8 +208,9 @@
     std::string targetNameSO;
     std::string targetNameReal;
     std::string targetNameImport;
+    std::string targetNamePDB;
     target->GetLibraryNames(targetName, targetNameSO, targetNameReal,
-                            targetNameImport, i->c_str());
+                            targetNameImport, targetNamePDB, i->c_str());
     if(this->ImportLibrary)
       {
       // Use the import library name.
@@ -245,8 +246,10 @@
     std::string targetNameSO;
     std::string targetNameReal;
     std::string targetNameImport;
+    std::string targetNamePDB;
     target->GetLibraryNames(targetName, targetNameSO, targetNameReal,
-                            targetNameImport, this->ConfigurationName);
+                            targetNameImport, targetNamePDB,
+                            this->ConfigurationName);
     if(this->ImportLibrary)
       {
       // Use the import library name.

Index: cmTarget.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTarget.cxx,v
retrieving revision 1.117
retrieving revision 1.118
diff -u -d -r1.117 -r1.118
--- cmTarget.cxx	8 Dec 2006 14:27:52 -0000	1.117
+++ cmTarget.cxx	1 Feb 2007 14:57:24 -0000	1.118
@@ -1541,10 +1541,11 @@
                                std::string& soName,
                                std::string& realName,
                                std::string& impName,
+                               std::string& pdbName,
                                const char* config)
 {
   // Get the names based on the real type of the library.
-  this->GetLibraryNamesInternal(name, soName, realName, impName,
+  this->GetLibraryNamesInternal(name, soName, realName, impName, pdbName,
                                 this->GetType(), config);
 }
 
@@ -1553,6 +1554,7 @@
                                     std::string& sharedSOName,
                                     std::string& sharedRealName,
                                     std::string& importName,
+                                    std::string& pdbName,
                                     const char* config)
 {
   // Get the name as if this were a static library.
@@ -1560,7 +1562,7 @@
   std::string realName;
   std::string impName;
   this->GetLibraryNamesInternal(staticName, soName, realName, impName,
-                                cmTarget::STATIC_LIBRARY, config);
+                                pdbName, cmTarget::STATIC_LIBRARY, config);
 
   // Get the names as if this were a shared library.
   if(this->GetType() == cmTarget::STATIC_LIBRARY)
@@ -1571,14 +1573,15 @@
     // type will never be MODULE.  Either way the only names that
     // might have to be cleaned are the shared library names.
     this->GetLibraryNamesInternal(sharedName, sharedSOName, sharedRealName,
-                                  importName, cmTarget::SHARED_LIBRARY,
-                                  config);
+                                  importName, pdbName,
+                                  cmTarget::SHARED_LIBRARY, config);
     }
   else
     {
     // Use the name of the real type of the library (shared or module).
     this->GetLibraryNamesInternal(sharedName, sharedSOName, sharedRealName,
-                                  importName, this->GetType(), config);
+                                  importName, pdbName, this->GetType(),
+                                  config);
     }
 }
 
@@ -1586,6 +1589,7 @@
                                        std::string& soName,
                                        std::string& realName,
                                        std::string& impName,
+                                       std::string& pdbName,
                                        TargetType type,
                                        const char* config)
 {
@@ -1672,27 +1676,34 @@
     {
     impName = "";
     }
+
+  // The program database file name.
+  pdbName = prefix+base+".pdb";
 }
 
 void cmTarget::GetExecutableNames(std::string& name,
                                   std::string& realName,
+                                  std::string& pdbName,
                                   const char* config)
 {
   // Get the names based on the real type of the executable.
-  this->GetExecutableNamesInternal(name, realName, this->GetType(), config);
+  this->GetExecutableNamesInternal(name, realName, pdbName,
+                                   this->GetType(), config);
 }
 
 void cmTarget::GetExecutableCleanNames(std::string& name,
                                        std::string& realName,
+                                       std::string& pdbName,
                                        const char* config)
 {
   // Get the name and versioned name of this executable.
-  this->GetExecutableNamesInternal(name, realName, cmTarget::EXECUTABLE,
-                                   config);
+  this->GetExecutableNamesInternal(name, realName, pdbName,
+                                   cmTarget::EXECUTABLE, config);
 }
 
 void cmTarget::GetExecutableNamesInternal(std::string& name,
                                           std::string& realName,
+                                          std::string& pdbName,
                                           TargetType type,
                                           const char* config)
 {
@@ -1732,6 +1743,9 @@
 #if defined(__CYGWIN__)
   realName += suffix;
 #endif
+
+  // The program database file name.
+  pdbName = prefix+base+".pdb";
 }
 
 //----------------------------------------------------------------------------



More information about the Cmake-commits mailing list