ENH: Converted some ConvertToRelativeOutputPath calls to ConvertToOptionallyRelativeOutputPath in preparation for making ConvertToRelativeOutputPath always convert. Some of these might be able to be switched back but we will first have to test what paths can be relative in the generate VS project files.

This commit is contained in:
Brad King 2005-02-24 18:35:36 -05:00
parent d680e51777
commit 397dc1cef5
2 changed files with 20 additions and 30 deletions

View File

@ -61,7 +61,7 @@ void cmLocalVisualStudio6Generator::OutputDSPFile()
for(i = includes.begin(); i != includes.end(); ++i)
{
m_IncludeOptions += " /I ";
std::string tmp = this->ConvertToRelativeOutputPath(i->c_str());
std::string tmp = this->ConvertToOptionallyRelativeOutputPath(i->c_str());
// quote if not already quoted
if (tmp[0] != '"')
@ -163,15 +163,10 @@ void cmLocalVisualStudio6Generator::AddDSPBuildRule()
{
std::string dspname = *(m_CreatedProjectNames.end()-1);
dspname += ".dsp.cmake";
std::string makefileIn = m_Makefile->GetStartDirectory();
makefileIn += "/";
makefileIn += "CMakeLists.txt";
makefileIn = this->ConvertToRelativeOutputPath(makefileIn.c_str());
const char* dsprule = m_Makefile->GetRequiredDefinition("CMAKE_COMMAND");
cmCustomCommandLine commandLine;
commandLine.push_back(dsprule);
commandLine.push_back(makefileIn);
makefileIn = m_Makefile->GetStartDirectory();
std::string makefileIn = m_Makefile->GetStartDirectory();
makefileIn += "/";
makefileIn += "CMakeLists.txt";
std::string args;
@ -357,7 +352,7 @@ void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout,
// Tell MS-Dev what the source is. If the compiler knows how to
// build it, then it will.
fout << "SOURCE=" <<
this->ConvertToRelativeOutputPath(source.c_str()) << "\n\n";
this->ConvertToOptionallyRelativeOutputPath(source.c_str()) << "\n\n";
if(!depends.empty())
{
// Write out the dependencies for the rule.
@ -366,7 +361,7 @@ void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout,
d != depends.end(); ++d)
{
fout << "\\\n\t" <<
this->ConvertToRelativeOutputPath(d->c_str());
this->ConvertToOptionallyRelativeOutputPath(d->c_str());
}
fout << "\n";
}
@ -470,12 +465,12 @@ void cmLocalVisualStudio6Generator::WriteCustomRule(std::ostream& fout,
libPath += dep;
libPath += ".exe";
fout << "\\\n\t" <<
this->ConvertToRelativeOutputPath(libPath.c_str());
this->ConvertToOptionallyRelativeOutputPath(libPath.c_str());
}
else
{
fout << "\\\n\t" <<
this->ConvertToRelativeOutputPath(d->c_str());
this->ConvertToOptionallyRelativeOutputPath(d->c_str());
}
}
fout << "\n";
@ -490,7 +485,7 @@ void cmLocalVisualStudio6Generator::WriteCustomRule(std::ostream& fout,
}
// Write a rule for every output generated by this command.
fout << this->ConvertToRelativeOutputPath(output)
fout << this->ConvertToOptionallyRelativeOutputPath(output)
<< " : \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\"\n\t";
fout << command << "\n\n";
fout << "# End Custom Build\n\n";
@ -722,13 +717,13 @@ void cmLocalVisualStudio6Generator::WriteDSPHeader(std::ostream& fout, const cha
libPath += "/";
}
std::string lpath =
this->ConvertToRelativeOutputPath(libPath.c_str());
this->ConvertToOptionallyRelativeOutputPath(libPath.c_str());
if(lpath.size() == 0)
{
lpath = ".";
}
std::string lpathIntDir = libPath + "$(INTDIR)";
lpathIntDir = this->ConvertToRelativeOutputPath(lpathIntDir.c_str());
lpathIntDir = this->ConvertToOptionallyRelativeOutputPath(lpathIntDir.c_str());
if(pathEmitted.insert(lpath).second)
{
libOptions += " /LIBPATH:";
@ -759,13 +754,13 @@ void cmLocalVisualStudio6Generator::WriteDSPHeader(std::ostream& fout, const cha
exePath += "/";
}
std::string lpath =
this->ConvertToRelativeOutputPath(exePath.c_str());
this->ConvertToOptionallyRelativeOutputPath(exePath.c_str());
if(lpath.size() == 0)
{
lpath = ".";
}
std::string lpathIntDir = exePath + "$(INTDIR)";
lpathIntDir = this->ConvertToRelativeOutputPath(lpathIntDir.c_str());
lpathIntDir = this->ConvertToOptionallyRelativeOutputPath(lpathIntDir.c_str());
if(pathEmitted.insert(lpath).second)
{
@ -799,13 +794,13 @@ void cmLocalVisualStudio6Generator::WriteDSPHeader(std::ostream& fout, const cha
path += "/";
}
std::string lpath =
this->ConvertToRelativeOutputPath(path.c_str());
this->ConvertToOptionallyRelativeOutputPath(path.c_str());
if(lpath.size() == 0)
{
lpath = ".";
}
std::string lpathIntDir = path + "$(INTDIR)";
lpathIntDir = this->ConvertToRelativeOutputPath(lpathIntDir.c_str());
lpathIntDir = this->ConvertToOptionallyRelativeOutputPath(lpathIntDir.c_str());
if(pathEmitted.insert(lpath).second)
{
libOptions += " /LIBPATH:";
@ -858,8 +853,8 @@ void cmLocalVisualStudio6Generator::WriteDSPHeader(std::ostream& fout, const cha
lib += ".lib";
libDebug += ".lib";
}
lib = this->ConvertToRelativeOutputPath(lib.c_str());
libDebug = this->ConvertToRelativeOutputPath(libDebug.c_str());
lib = this->ConvertToOptionallyRelativeOutputPath(lib.c_str());
libDebug = this->ConvertToOptionallyRelativeOutputPath(libDebug.c_str());
if (j->second == cmTarget::GENERAL)
{
@ -1024,10 +1019,10 @@ void cmLocalVisualStudio6Generator::WriteDSPHeader(std::ostream& fout, const cha
// to convert to output path for unix to win32 conversion
cmSystemTools::ReplaceString(line, "LIBRARY_OUTPUT_PATH",
removeQuotes(
this->ConvertToRelativeOutputPath(libPath.c_str())).c_str());
this->ConvertToOptionallyRelativeOutputPath(libPath.c_str())).c_str());
cmSystemTools::ReplaceString(line, "EXECUTABLE_OUTPUT_PATH",
removeQuotes(
this->ConvertToRelativeOutputPath(exePath.c_str())).c_str());
this->ConvertToOptionallyRelativeOutputPath(exePath.c_str())).c_str());
cmSystemTools::ReplaceString(line,
"EXTRA_DEFINES",
m_Makefile->GetDefineFlags());

View File

@ -135,15 +135,10 @@ void cmLocalVisualStudio7Generator::AddVCProjBuildRule()
{
std::string dspname = *(m_CreatedProjectNames.end()-1);
dspname += ".vcproj.cmake";
std::string makefileIn = m_Makefile->GetStartDirectory();
makefileIn += "/";
makefileIn += "CMakeLists.txt";
makefileIn = this->ConvertToRelativeOutputPath(makefileIn.c_str());
const char* dsprule = m_Makefile->GetRequiredDefinition("CMAKE_COMMAND");
cmCustomCommandLine commandLine;
commandLine.push_back(dsprule);
commandLine.push_back(makefileIn);
makefileIn = m_Makefile->GetStartDirectory();
std::string makefileIn = m_Makefile->GetStartDirectory();
makefileIn += "/";
makefileIn += "CMakeLists.txt";
std::string args;
@ -1317,7 +1312,7 @@ std::string cmLocalVisualStudio7Generator::EscapeForXML(const char* s)
std::string cmLocalVisualStudio7Generator::ConvertToXMLOutputPath(const char* path)
{
std::string ret = this->ConvertToRelativeOutputPath(path);
std::string ret = this->ConvertToOptionallyRelativeOutputPath(path);
cmSystemTools::ReplaceString(ret, "&", "&amp;");
cmSystemTools::ReplaceString(ret, "\"", "&quot;");
cmSystemTools::ReplaceString(ret, "<", "&lt;");
@ -1327,7 +1322,7 @@ std::string cmLocalVisualStudio7Generator::ConvertToXMLOutputPath(const char* pa
std::string cmLocalVisualStudio7Generator::ConvertToXMLOutputPathSingle(const char* path)
{
std::string ret = this->ConvertToRelativeOutputPath(path);
std::string ret = this->ConvertToOptionallyRelativeOutputPath(path);
cmSystemTools::ReplaceString(ret, "\"", "");
cmSystemTools::ReplaceString(ret, "&", "&amp;");
cmSystemTools::ReplaceString(ret, "<", "&lt;");