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

This commit is contained in:
Brad King 2007-03-08 15:33:19 -05:00
parent 789a0f8359
commit 01dc699d82
6 changed files with 19 additions and 15 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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