Ver Fonte

ENH: Combined cmTarget::GetDirectory and cmTarget::GetOutputDir since they are nearly the same. This is another step for bug#2240.

Brad King há 18 anos atrás
pai
commit
01dc699d82

+ 7 - 7
Source/cmLocalVisualStudio7Generator.cxx

@@ -605,7 +605,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
       target.GetType() == cmTarget::MODULE_LIBRARY))
     {
     fout <<  "\t\t\t\tProgramDataBaseFileName=\""
-         << target.GetOutputDir() << "/$(OutDir)/"
+         << target.GetDirectory() << "/$(OutDir)/"
          << target.GetPDBName(configName) << "\"\n";
     }
   fout << "/>\n";  // end of <Tool Name=VCCLCompilerTool
@@ -728,7 +728,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
     case cmTarget::STATIC_LIBRARY:
     {
     std::string targetNameFull = target.GetFullName(configName);
-    std::string libpath = target.GetOutputDir();
+    std::string libpath = target.GetDirectory();
     libpath += "/$(OutDir)/";
     libpath += targetNameFull;
     fout << "\t\t\t<Tool\n"
@@ -795,7 +795,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
          << " ";
     this->OutputLibraries(fout, linkLibs);
     fout << "\"\n";
-    temp = target.GetOutputDir();
+    temp = target.GetDirectory();
     temp += "/";
     temp += configName;
     temp += "/";
@@ -808,7 +808,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
     this->OutputLibraryDirectories(fout, linkDirs);
     fout << "\"\n";
     this->OutputModuleDefinitionFile(fout, target);
-    temp = target.GetOutputDir();
+    temp = target.GetDirectory();
     temp += "/$(OutDir)/";
     temp += targetNamePDB;
     fout << "\t\t\t\tProgramDataBaseFile=\"" <<
@@ -826,7 +826,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
       {
       fout << "\t\t\t\tStackReserveSize=\"" << stackVal  << "\"\n";
       }
-    temp = target.GetOutputDir();
+    temp = target.GetDirectory();
     temp += "/";
     temp += configName;
     temp += "/";
@@ -875,7 +875,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
          << " ";
     this->OutputLibraries(fout, linkLibs);
     fout << "\"\n";
-    temp = target.GetOutputDir();
+    temp = target.GetDirectory();
     temp += "/";
     temp += configName;
     temp += "/";
@@ -888,7 +888,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
     this->OutputLibraryDirectories(fout, linkDirs);
     fout << "\"\n";
     fout << "\t\t\t\tProgramDataBaseFile=\""
-         << target.GetOutputDir() << "\\$(OutDir)\\" << targetNamePDB
+         << target.GetDirectory() << "\\$(OutDir)\\" << targetNamePDB
          << "\"\n";
     if(strcmp(configName, "Debug") == 0
        || strcmp(configName, "RelWithDebInfo") == 0)

+ 1 - 1
Source/cmMakefileExecutableTargetGenerator.cxx

@@ -116,7 +116,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
      this->LocalGenerator->ConfigurationName.c_str());
 
   // Construct the full path version of the names.
-  std::string outpath = this->Target->GetOutputDir();
+  std::string outpath = this->Target->GetDirectory();
   outpath += "/";
 #ifdef __APPLE__
   if(this->Target->GetPropertyAsBool("MACOSX_BUNDLE"))

+ 1 - 1
Source/cmMakefileLibraryTargetGenerator.cxx

@@ -256,7 +256,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
     }
   else
     {
-    outpath = this->Target->GetOutputDir();
+    outpath = this->Target->GetDirectory();
     outpath += "/";
     }
   std::string targetFullPath = outpath + targetName;

+ 1 - 1
Source/cmMakefileTargetGenerator.cxx

@@ -471,7 +471,7 @@ cmMakefileTargetGenerator
      this->Target->GetType() == cmTarget::SHARED_LIBRARY ||
      this->Target->GetType() == cmTarget::MODULE_LIBRARY)
     {
-    targetFullPathPDB = this->Target->GetOutputDir();
+    targetFullPathPDB = this->Target->GetDirectory();
     targetFullPathPDB += "/";
     targetFullPathPDB += this->Target->GetPDBName(configName);
     }

+ 6 - 2
Source/cmTarget.cxx

@@ -1093,14 +1093,18 @@ void cmTarget::SetProperty(const char* prop, const char* value)
 
 const char* cmTarget::GetDirectory(const char* config)
 {
-  this->Directory = this->GetOutputDir();
   if(config)
     {
+    this->Directory = this->GetOutputDir();
     // Add the configuration's subdirectory.
     this->Makefile->GetLocalGenerator()->GetGlobalGenerator()->
       AppendDirectoryForConfig("/", config, "", this->Directory);
+    return this->Directory.c_str();
+    }
+  else
+    {
+    return this->GetOutputDir();
     }
-  return this->Directory.c_str();
 }
 
 const char* cmTarget::GetLocation(const char* config)

+ 3 - 3
Source/cmTarget.h

@@ -213,9 +213,6 @@ public:
       makefile and the configuration type.  */
   std::string GetFullPath(const char* config=0, bool implib = false);
 
-  /** Get the full path to the target output directory.  */
-  const char* GetOutputDir();
-
   /** Get the names of the library needed to generate a build rule
       that takes into account shared library version numbers.  This
       should be called only on a library target.  */
@@ -342,6 +339,9 @@ private:
   // If the variable is not defined use the given default instead.
   void SetPropertyDefault(const char* property, const char* default_value);
 
+  // Get the full path to the target output directory.
+  const char* GetOutputDir();
+
 private:
   std::string Name;
   std::vector<cmCustomCommand> PreBuildCommands;