summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalVisualStudio6Generator.cxx
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2008-12-09 21:07:10 (GMT)
committerDavid Cole <david.cole@kitware.com>2008-12-09 21:07:10 (GMT)
commit16f35e189e9af72be1422245391c4b3ba9cd826c (patch)
tree78e517fd01c86bbd08b2a658842b0f86192a3924 /Source/cmGlobalVisualStudio6Generator.cxx
parent09084d89fb16a7ffc0d8ebf642cd478c51ad65ef (diff)
downloadCMake-16f35e189e9af72be1422245391c4b3ba9cd826c.zip
CMake-16f35e189e9af72be1422245391c4b3ba9cd826c.tar.gz
CMake-16f35e189e9af72be1422245391c4b3ba9cd826c.tar.bz2
COMP: Fix the ExternalProject test for Visual Studio 6. Visual Studio 6 *.dsp files cannot have hyphens in them. Add utility function GetVS6TargetName to replace hyphens with underscores when generating *.dsp file names. Use the function everywhere necessary in the VS6 generators. And, a workaround: VS6 uses ".\Debug" (for example) as an "$(IntDir)" value - strip any leading ".\" when processing a --config argument in the cmake --build handling code.
Diffstat (limited to 'Source/cmGlobalVisualStudio6Generator.cxx')
-rw-r--r--Source/cmGlobalVisualStudio6Generator.cxx23
1 files changed, 20 insertions, 3 deletions
diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx
index 723ac7c..e6456e8 100644
--- a/Source/cmGlobalVisualStudio6Generator.cxx
+++ b/Source/cmGlobalVisualStudio6Generator.cxx
@@ -372,6 +372,23 @@ void cmGlobalVisualStudio6Generator::OutputDSWFile()
}
}
+
+// Utility function to make a valid VS6 *.dsp filename out
+// of a CMake target name:
+//
+std::string GetVS6TargetName(const std::string& targetName)
+{
+ std::string name(targetName);
+
+ // Eliminate hyphens. VS6 cannot handle hyphens in *.dsp filenames...
+ // Replace them with underscores.
+ //
+ cmSystemTools::ReplaceString(name, "-", "_");
+
+ return name;
+}
+
+
// Write a dsp file into the DSW file,
// Note, that dependencies from executables to
// the libraries it uses are also done here
@@ -402,7 +419,7 @@ void cmGlobalVisualStudio6Generator::WriteProject(std::ostream& fout,
if(this->FindTarget(0, j->first.c_str()))
{
fout << "Begin Project Dependency\n";
- fout << "Project_Dep_Name " << j->first.c_str() << "\n";
+ fout << "Project_Dep_Name " << GetVS6TargetName(j->first.c_str()) << "\n";
fout << "End Project Dependency\n";
}
}
@@ -419,7 +436,7 @@ void cmGlobalVisualStudio6Generator::WriteProject(std::ostream& fout,
{
std::string depName = this->GetUtilityForTarget(target, i->c_str());
fout << "Begin Project Dependency\n";
- fout << "Project_Dep_Name " << depName << "\n";
+ fout << "Project_Dep_Name " << GetVS6TargetName(depName) << "\n";
fout << "End Project Dependency\n";
}
}
@@ -451,7 +468,7 @@ void cmGlobalVisualStudio6Generator::WriteExternalProject(std::ostream& fout,
for(;i!= end; ++i)
{
fout << "Begin Project Dependency\n";
- fout << "Project_Dep_Name " << *i << "\n";
+ fout << "Project_Dep_Name " << GetVS6TargetName(*i) << "\n";
fout << "End Project Dependency\n";
}
fout << "}}}\n\n";