summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalVisualStudio7Generator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2007-03-08 19:57:28 (GMT)
committerBrad King <brad.king@kitware.com>2007-03-08 19:57:28 (GMT)
commit33ee83714d3cea644f9d1cd6654c2e7b1f3cdc5d (patch)
tree5f2f82863c856ed2f5c1f04158eb228ac1477c24 /Source/cmLocalVisualStudio7Generator.cxx
parentea19994b13273cf6e1f7677cc29ce53cf1a59768 (diff)
downloadCMake-33ee83714d3cea644f9d1cd6654c2e7b1f3cdc5d.zip
CMake-33ee83714d3cea644f9d1cd6654c2e7b1f3cdc5d.tar.gz
CMake-33ee83714d3cea644f9d1cd6654c2e7b1f3cdc5d.tar.bz2
ENH: Replaced LibraryOutputPath and ExecutableOutputPath variables in Makefile and VS generators to instead ask each target for its output path. This significantly reduces total code size and centralizes previously duplicate code. It is also a step towards bug#2240.
Diffstat (limited to 'Source/cmLocalVisualStudio7Generator.cxx')
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx75
1 files changed, 22 insertions, 53 deletions
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index abfaa71..bd13095 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -105,35 +105,6 @@ void cmLocalVisualStudio7Generator::OutputVCProjFile()
}
}
- this->LibraryOutputPath = "";
- if (this->Makefile->GetDefinition("LIBRARY_OUTPUT_PATH"))
- {
- this->LibraryOutputPath =
- this->Makefile->GetDefinition("LIBRARY_OUTPUT_PATH");
- }
- if(this->LibraryOutputPath.size())
- {
- // make sure there is a trailing slash
- if(this->LibraryOutputPath[this->LibraryOutputPath.size()-1] != '/')
- {
- this->LibraryOutputPath += "/";
- }
- }
- this->ExecutableOutputPath = "";
- if (this->Makefile->GetDefinition("EXECUTABLE_OUTPUT_PATH"))
- {
- this->ExecutableOutputPath =
- this->Makefile->GetDefinition("EXECUTABLE_OUTPUT_PATH");
- }
- if(this->ExecutableOutputPath.size())
- {
- // make sure there is a trailing slash
- if(this->ExecutableOutputPath[this->ExecutableOutputPath.size()-1] != '/')
- {
- this->ExecutableOutputPath += "/";
- }
- }
-
// Create the VCProj or set of VCProj's for libraries and executables
// clear project names
@@ -627,22 +598,15 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
targetOptions.OutputPreprocessorDefinitions(fout, "\t\t\t\t", "\n");
fout << "\t\t\t\tAssemblerListingLocation=\"" << configName << "\"\n";
fout << "\t\t\t\tObjectFile=\"$(IntDir)\\\"\n";
- if(targetOptions.UsingDebugPDB())
+ if(targetOptions.UsingDebugPDB() &&
+ (target.GetType() == cmTarget::EXECUTABLE ||
+ target.GetType() == cmTarget::STATIC_LIBRARY ||
+ target.GetType() == cmTarget::SHARED_LIBRARY ||
+ target.GetType() == cmTarget::MODULE_LIBRARY))
{
- if(target.GetType() == cmTarget::EXECUTABLE)
- {
- fout << "\t\t\t\tProgramDataBaseFileName=\""
- << this->ExecutableOutputPath
- << "$(OutDir)/" << target.GetPDBName(configName) << "\"\n";
- }
- else if(target.GetType() == cmTarget::STATIC_LIBRARY ||
- target.GetType() == cmTarget::SHARED_LIBRARY ||
- target.GetType() == cmTarget::MODULE_LIBRARY)
- {
- fout << "\t\t\t\tProgramDataBaseFileName=\""
- << this->LibraryOutputPath
- << "$(OutDir)/" << target.GetPDBName(configName) << "\"\n";
- }
+ fout << "\t\t\t\tProgramDataBaseFileName=\""
+ << target.GetOutputDir() << "/$(OutDir)/"
+ << target.GetPDBName(configName) << "\"\n";
}
fout << "/>\n"; // end of <Tool Name=VCCLCompilerTool
fout << "\t\t\t<Tool\n\t\t\t\tName=\"VCCustomBuildTool\"/>\n";
@@ -764,8 +728,9 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
case cmTarget::STATIC_LIBRARY:
{
std::string targetNameFull = target.GetFullName(configName);
- std::string libpath = this->LibraryOutputPath +
- "$(OutDir)/" + targetNameFull;
+ std::string libpath = target.GetOutputDir();
+ libpath += "/$(OutDir)/";
+ libpath += targetNameFull;
fout << "\t\t\t<Tool\n"
<< "\t\t\t\tName=\"VCLibrarianTool\"\n";
if(const char* libflags = target.GetProperty("STATIC_LIBRARY_FLAGS"))
@@ -830,7 +795,8 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
<< " ";
this->OutputLibraries(fout, linkLibs);
fout << "\"\n";
- temp = this->LibraryOutputPath;
+ temp = target.GetOutputDir();
+ temp += "/";
temp += configName;
temp += "/";
temp += targetNameFull;
@@ -842,8 +808,8 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
this->OutputLibraryDirectories(fout, linkDirs);
fout << "\"\n";
this->OutputModuleDefinitionFile(fout, target);
- temp = this->LibraryOutputPath;
- temp += "$(OutDir)/";
+ temp = target.GetOutputDir();
+ temp += "/$(OutDir)/";
temp += targetNamePDB;
fout << "\t\t\t\tProgramDataBaseFile=\"" <<
this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n";
@@ -860,7 +826,8 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
{
fout << "\t\t\t\tStackReserveSize=\"" << stackVal << "\"\n";
}
- temp = this->LibraryOutputPath;
+ temp = target.GetOutputDir();
+ temp += "/";
temp += configName;
temp += "/";
temp += targetNameImport;
@@ -908,7 +875,8 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
<< " ";
this->OutputLibraries(fout, linkLibs);
fout << "\"\n";
- temp = this->ExecutableOutputPath;
+ temp = target.GetOutputDir();
+ temp += "/";
temp += configName;
temp += "/";
temp += targetNameFull;
@@ -919,8 +887,9 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
fout << "\t\t\t\tAdditionalLibraryDirectories=\"";
this->OutputLibraryDirectories(fout, linkDirs);
fout << "\"\n";
- fout << "\t\t\t\tProgramDataBaseFile=\"" << this->ExecutableOutputPath
- << "$(OutDir)\\" << targetNamePDB << "\"\n";
+ fout << "\t\t\t\tProgramDataBaseFile=\""
+ << target.GetOutputDir() << "\\$(OutDir)\\" << targetNamePDB
+ << "\"\n";
if(strcmp(configName, "Debug") == 0
|| strcmp(configName, "RelWithDebInfo") == 0)
{