ENH: add relative paths to visual studio 6 and 7 project files
This commit is contained in:
parent
d79e3ae698
commit
0bdb092a01
@ -57,7 +57,7 @@ void cmLocalVisualStudio6Generator::OutputDSPFile()
|
|||||||
for(i = includes.begin(); i != includes.end(); ++i)
|
for(i = includes.begin(); i != includes.end(); ++i)
|
||||||
{
|
{
|
||||||
m_IncludeOptions += " /I ";
|
m_IncludeOptions += " /I ";
|
||||||
std::string tmp = cmSystemTools::ConvertToOutputPath(i->c_str());
|
std::string tmp = this->ConvertToRelativeOutputPath(i->c_str());
|
||||||
|
|
||||||
// quote if not already quoted
|
// quote if not already quoted
|
||||||
if (tmp[0] != '"')
|
if (tmp[0] != '"')
|
||||||
@ -171,10 +171,10 @@ void cmLocalVisualStudio6Generator::AddDSPBuildRule()
|
|||||||
std::string makefileIn = m_Makefile->GetStartDirectory();
|
std::string makefileIn = m_Makefile->GetStartDirectory();
|
||||||
makefileIn += "/";
|
makefileIn += "/";
|
||||||
makefileIn += "CMakeLists.txt";
|
makefileIn += "CMakeLists.txt";
|
||||||
makefileIn = cmSystemTools::ConvertToOutputPath(makefileIn.c_str());
|
makefileIn = this->ConvertToRelativeOutputPath(makefileIn.c_str());
|
||||||
std::string dsprule = "${CMAKE_COMMAND}";
|
std::string dsprule = "${CMAKE_COMMAND}";
|
||||||
m_Makefile->ExpandVariablesInString(dsprule);
|
m_Makefile->ExpandVariablesInString(dsprule);
|
||||||
dsprule = cmSystemTools::ConvertToOutputPath(dsprule.c_str());
|
dsprule = this->ConvertToRelativeOutputPath(dsprule.c_str());
|
||||||
std::vector<std::string> argv;
|
std::vector<std::string> argv;
|
||||||
argv.push_back(makefileIn);
|
argv.push_back(makefileIn);
|
||||||
makefileIn = m_Makefile->GetStartDirectory();
|
makefileIn = m_Makefile->GetStartDirectory();
|
||||||
@ -183,19 +183,19 @@ void cmLocalVisualStudio6Generator::AddDSPBuildRule()
|
|||||||
std::string args;
|
std::string args;
|
||||||
args = "-H";
|
args = "-H";
|
||||||
args +=
|
args +=
|
||||||
cmSystemTools::ConvertToOutputPath(m_Makefile->GetHomeDirectory());
|
this->ConvertToRelativeOutputPath(m_Makefile->GetHomeDirectory());
|
||||||
argv.push_back(args);
|
argv.push_back(args);
|
||||||
args = "-S";
|
args = "-S";
|
||||||
args +=
|
args +=
|
||||||
cmSystemTools::ConvertToOutputPath(m_Makefile->GetStartDirectory());
|
this->ConvertToRelativeOutputPath(m_Makefile->GetStartDirectory());
|
||||||
argv.push_back(args);
|
argv.push_back(args);
|
||||||
args = "-O";
|
args = "-O";
|
||||||
args +=
|
args +=
|
||||||
cmSystemTools::ConvertToOutputPath(m_Makefile->GetStartOutputDirectory());
|
this->ConvertToRelativeOutputPath(m_Makefile->GetStartOutputDirectory());
|
||||||
argv.push_back(args);
|
argv.push_back(args);
|
||||||
args = "-B";
|
args = "-B";
|
||||||
args +=
|
args +=
|
||||||
cmSystemTools::ConvertToOutputPath(m_Makefile->GetHomeOutputDirectory());
|
this->ConvertToRelativeOutputPath(m_Makefile->GetHomeOutputDirectory());
|
||||||
argv.push_back(args);
|
argv.push_back(args);
|
||||||
|
|
||||||
std::string configFile =
|
std::string configFile =
|
||||||
@ -374,7 +374,7 @@ void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout,
|
|||||||
// Tell MS-Dev what the source is. If the compiler knows how to
|
// Tell MS-Dev what the source is. If the compiler knows how to
|
||||||
// build it, then it will.
|
// build it, then it will.
|
||||||
fout << "SOURCE=" <<
|
fout << "SOURCE=" <<
|
||||||
cmSystemTools::ConvertToOutputPath(source.c_str()) << "\n\n";
|
this->ConvertToRelativeOutputPath(source.c_str()) << "\n\n";
|
||||||
if(!depends.empty())
|
if(!depends.empty())
|
||||||
{
|
{
|
||||||
// Write out the dependencies for the rule.
|
// Write out the dependencies for the rule.
|
||||||
@ -383,7 +383,7 @@ void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout,
|
|||||||
d != depends.end(); ++d)
|
d != depends.end(); ++d)
|
||||||
{
|
{
|
||||||
fout << "\\\n\t" <<
|
fout << "\\\n\t" <<
|
||||||
cmSystemTools::ConvertToOutputPath(d->c_str());
|
this->ConvertToRelativeOutputPath(d->c_str());
|
||||||
}
|
}
|
||||||
fout << "\n";
|
fout << "\n";
|
||||||
}
|
}
|
||||||
@ -391,7 +391,7 @@ void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout,
|
|||||||
{
|
{
|
||||||
std::string totalCommandStr;
|
std::string totalCommandStr;
|
||||||
totalCommandStr =
|
totalCommandStr =
|
||||||
cmSystemTools::ConvertToOutputPath(command->GetCommand().c_str());
|
this->ConvertToRelativeOutputPath(command->GetCommand().c_str());
|
||||||
totalCommandStr += " ";
|
totalCommandStr += " ";
|
||||||
totalCommandStr += command->GetArguments();
|
totalCommandStr += command->GetArguments();
|
||||||
totalCommandStr += "\n";
|
totalCommandStr += "\n";
|
||||||
@ -491,12 +491,12 @@ void cmLocalVisualStudio6Generator::WriteCustomRule(std::ostream& fout,
|
|||||||
libPath += dep;
|
libPath += dep;
|
||||||
libPath += ".exe";
|
libPath += ".exe";
|
||||||
fout << "\\\n\t" <<
|
fout << "\\\n\t" <<
|
||||||
cmSystemTools::ConvertToOutputPath(libPath.c_str());
|
this->ConvertToRelativeOutputPath(libPath.c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fout << "\\\n\t" <<
|
fout << "\\\n\t" <<
|
||||||
cmSystemTools::ConvertToOutputPath(d->c_str());
|
this->ConvertToRelativeOutputPath(d->c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fout << "\n";
|
fout << "\n";
|
||||||
@ -511,7 +511,7 @@ void cmLocalVisualStudio6Generator::WriteCustomRule(std::ostream& fout,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Write a rule for every output generated by this command.
|
// Write a rule for every output generated by this command.
|
||||||
fout << cmSystemTools::ConvertToOutputPath(output)
|
fout << this->ConvertToRelativeOutputPath(output)
|
||||||
<< " : \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\"\n\t";
|
<< " : \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\"\n\t";
|
||||||
fout << command << "\n\n";
|
fout << command << "\n\n";
|
||||||
fout << "# End Custom Build\n\n";
|
fout << "# End Custom Build\n\n";
|
||||||
@ -666,7 +666,7 @@ cmLocalVisualStudio6Generator::CreateTargetRules(const cmTarget &target,
|
|||||||
{
|
{
|
||||||
customRuleCode += "\t";
|
customRuleCode += "\t";
|
||||||
}
|
}
|
||||||
customRuleCode += cmSystemTools::ConvertToOutputPath(cc.GetCommand().c_str()) + " " + cc.GetArguments();
|
customRuleCode += this->ConvertToRelativeOutputPath(cc.GetCommand().c_str()) + " " + cc.GetArguments();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (std::vector<cmCustomCommand>::const_iterator cr =
|
for (std::vector<cmCustomCommand>::const_iterator cr =
|
||||||
@ -685,7 +685,7 @@ cmLocalVisualStudio6Generator::CreateTargetRules(const cmTarget &target,
|
|||||||
{
|
{
|
||||||
customRuleCode += "\t";
|
customRuleCode += "\t";
|
||||||
}
|
}
|
||||||
customRuleCode += cmSystemTools::ConvertToOutputPath(cc.GetCommand().c_str()) + " " + cc.GetArguments();
|
customRuleCode += this->ConvertToRelativeOutputPath(cc.GetCommand().c_str()) + " " + cc.GetArguments();
|
||||||
}
|
}
|
||||||
|
|
||||||
// do the post build rules
|
// do the post build rules
|
||||||
@ -707,7 +707,7 @@ cmLocalVisualStudio6Generator::CreateTargetRules(const cmTarget &target,
|
|||||||
customRuleCode += "\t";
|
customRuleCode += "\t";
|
||||||
}
|
}
|
||||||
customRuleCode +=
|
customRuleCode +=
|
||||||
cmSystemTools::ConvertToOutputPath(cc.GetCommand().c_str()) +
|
this->ConvertToRelativeOutputPath(cc.GetCommand().c_str()) +
|
||||||
" " + cc.GetArguments();
|
" " + cc.GetArguments();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -753,7 +753,6 @@ void cmLocalVisualStudio6Generator::WriteDSPHeader(std::ostream& fout, const cha
|
|||||||
{
|
{
|
||||||
exePath = m_Makefile->GetDefinition("EXECUTABLE_OUTPUT_PATH");
|
exePath = m_Makefile->GetDefinition("EXECUTABLE_OUTPUT_PATH");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(libPath.size())
|
if(libPath.size())
|
||||||
{
|
{
|
||||||
// make sure there is a trailing slash
|
// make sure there is a trailing slash
|
||||||
@ -762,9 +761,13 @@ void cmLocalVisualStudio6Generator::WriteDSPHeader(std::ostream& fout, const cha
|
|||||||
libPath += "/";
|
libPath += "/";
|
||||||
}
|
}
|
||||||
std::string lpath =
|
std::string lpath =
|
||||||
cmSystemTools::ConvertToOutputPath(libPath.c_str());
|
this->ConvertToRelativeOutputPath(libPath.c_str());
|
||||||
|
if(lpath.size() == 0)
|
||||||
|
{
|
||||||
|
lpath = ".";
|
||||||
|
}
|
||||||
std::string lpathIntDir = libPath + "$(INTDIR)";
|
std::string lpathIntDir = libPath + "$(INTDIR)";
|
||||||
lpathIntDir = cmSystemTools::ConvertToOutputPath(lpathIntDir.c_str());
|
lpathIntDir = this->ConvertToRelativeOutputPath(lpathIntDir.c_str());
|
||||||
if(pathEmitted.insert(lpath).second)
|
if(pathEmitted.insert(lpath).second)
|
||||||
{
|
{
|
||||||
libOptions += " /LIBPATH:";
|
libOptions += " /LIBPATH:";
|
||||||
@ -795,9 +798,13 @@ void cmLocalVisualStudio6Generator::WriteDSPHeader(std::ostream& fout, const cha
|
|||||||
exePath += "/";
|
exePath += "/";
|
||||||
}
|
}
|
||||||
std::string lpath =
|
std::string lpath =
|
||||||
cmSystemTools::ConvertToOutputPath(exePath.c_str());
|
this->ConvertToRelativeOutputPath(exePath.c_str());
|
||||||
|
if(lpath.size() == 0)
|
||||||
|
{
|
||||||
|
lpath = ".";
|
||||||
|
}
|
||||||
std::string lpathIntDir = exePath + "$(INTDIR)";
|
std::string lpathIntDir = exePath + "$(INTDIR)";
|
||||||
lpathIntDir = cmSystemTools::ConvertToOutputPath(lpathIntDir.c_str());
|
lpathIntDir = this->ConvertToRelativeOutputPath(lpathIntDir.c_str());
|
||||||
|
|
||||||
if(pathEmitted.insert(lpath).second)
|
if(pathEmitted.insert(lpath).second)
|
||||||
{
|
{
|
||||||
@ -831,9 +838,13 @@ void cmLocalVisualStudio6Generator::WriteDSPHeader(std::ostream& fout, const cha
|
|||||||
path += "/";
|
path += "/";
|
||||||
}
|
}
|
||||||
std::string lpath =
|
std::string lpath =
|
||||||
cmSystemTools::ConvertToOutputPath(path.c_str());
|
this->ConvertToRelativeOutputPath(path.c_str());
|
||||||
|
if(lpath.size() == 0)
|
||||||
|
{
|
||||||
|
lpath = ".";
|
||||||
|
}
|
||||||
std::string lpathIntDir = path + "$(INTDIR)";
|
std::string lpathIntDir = path + "$(INTDIR)";
|
||||||
lpathIntDir = cmSystemTools::ConvertToOutputPath(lpathIntDir.c_str());
|
lpathIntDir = this->ConvertToRelativeOutputPath(lpathIntDir.c_str());
|
||||||
if(pathEmitted.insert(lpath).second)
|
if(pathEmitted.insert(lpath).second)
|
||||||
{
|
{
|
||||||
libOptions += " /LIBPATH:";
|
libOptions += " /LIBPATH:";
|
||||||
@ -886,8 +897,8 @@ void cmLocalVisualStudio6Generator::WriteDSPHeader(std::ostream& fout, const cha
|
|||||||
lib += ".lib";
|
lib += ".lib";
|
||||||
libDebug += ".lib";
|
libDebug += ".lib";
|
||||||
}
|
}
|
||||||
lib = cmSystemTools::ConvertToOutputPath(lib.c_str());
|
lib = this->ConvertToRelativeOutputPath(lib.c_str());
|
||||||
libDebug = cmSystemTools::ConvertToOutputPath(libDebug.c_str());
|
libDebug = this->ConvertToRelativeOutputPath(libDebug.c_str());
|
||||||
|
|
||||||
if (j->second == cmTarget::GENERAL)
|
if (j->second == cmTarget::GENERAL)
|
||||||
{
|
{
|
||||||
@ -1010,10 +1021,10 @@ void cmLocalVisualStudio6Generator::WriteDSPHeader(std::ostream& fout, const cha
|
|||||||
// to convert to output path for unix to win32 conversion
|
// to convert to output path for unix to win32 conversion
|
||||||
cmSystemTools::ReplaceString(line, "LIBRARY_OUTPUT_PATH",
|
cmSystemTools::ReplaceString(line, "LIBRARY_OUTPUT_PATH",
|
||||||
removeQuotes(
|
removeQuotes(
|
||||||
cmSystemTools::ConvertToOutputPath(libPath.c_str())).c_str());
|
this->ConvertToRelativeOutputPath(libPath.c_str())).c_str());
|
||||||
cmSystemTools::ReplaceString(line, "EXECUTABLE_OUTPUT_PATH",
|
cmSystemTools::ReplaceString(line, "EXECUTABLE_OUTPUT_PATH",
|
||||||
removeQuotes(
|
removeQuotes(
|
||||||
cmSystemTools::ConvertToOutputPath(exePath.c_str())).c_str());
|
this->ConvertToRelativeOutputPath(exePath.c_str())).c_str());
|
||||||
cmSystemTools::ReplaceString(line,
|
cmSystemTools::ReplaceString(line,
|
||||||
"EXTRA_DEFINES",
|
"EXTRA_DEFINES",
|
||||||
m_Makefile->GetDefineFlags());
|
m_Makefile->GetDefineFlags());
|
||||||
|
@ -141,10 +141,10 @@ void cmLocalVisualStudio7Generator::AddVCProjBuildRule()
|
|||||||
std::string makefileIn = m_Makefile->GetStartDirectory();
|
std::string makefileIn = m_Makefile->GetStartDirectory();
|
||||||
makefileIn += "/";
|
makefileIn += "/";
|
||||||
makefileIn += "CMakeLists.txt";
|
makefileIn += "CMakeLists.txt";
|
||||||
makefileIn = cmSystemTools::ConvertToOutputPath(makefileIn.c_str());
|
makefileIn = this->ConvertToRelativeOutputPath(makefileIn.c_str());
|
||||||
std::string dsprule = "${CMAKE_COMMAND}";
|
std::string dsprule = "${CMAKE_COMMAND}";
|
||||||
m_Makefile->ExpandVariablesInString(dsprule);
|
m_Makefile->ExpandVariablesInString(dsprule);
|
||||||
dsprule = cmSystemTools::ConvertToOutputPath(dsprule.c_str());
|
dsprule = this->ConvertToRelativeOutputPath(dsprule.c_str());
|
||||||
std::vector<std::string> argv;
|
std::vector<std::string> argv;
|
||||||
argv.push_back(makefileIn);
|
argv.push_back(makefileIn);
|
||||||
makefileIn = m_Makefile->GetStartDirectory();
|
makefileIn = m_Makefile->GetStartDirectory();
|
||||||
@ -153,19 +153,19 @@ void cmLocalVisualStudio7Generator::AddVCProjBuildRule()
|
|||||||
std::string args;
|
std::string args;
|
||||||
args = "-H";
|
args = "-H";
|
||||||
args +=
|
args +=
|
||||||
cmSystemTools::ConvertToOutputPath(m_Makefile->GetHomeDirectory());
|
this->ConvertToRelativeOutputPath(m_Makefile->GetHomeDirectory());
|
||||||
argv.push_back(args);
|
argv.push_back(args);
|
||||||
args = "-S";
|
args = "-S";
|
||||||
args +=
|
args +=
|
||||||
cmSystemTools::ConvertToOutputPath(m_Makefile->GetStartDirectory());
|
this->ConvertToRelativeOutputPath(m_Makefile->GetStartDirectory());
|
||||||
argv.push_back(args);
|
argv.push_back(args);
|
||||||
args = "-O";
|
args = "-O";
|
||||||
args +=
|
args +=
|
||||||
cmSystemTools::ConvertToOutputPath(m_Makefile->GetStartOutputDirectory());
|
this->ConvertToRelativeOutputPath(m_Makefile->GetStartOutputDirectory());
|
||||||
argv.push_back(args);
|
argv.push_back(args);
|
||||||
args = "-B";
|
args = "-B";
|
||||||
args +=
|
args +=
|
||||||
cmSystemTools::ConvertToOutputPath(m_Makefile->GetHomeOutputDirectory());
|
this->ConvertToRelativeOutputPath(m_Makefile->GetHomeOutputDirectory());
|
||||||
argv.push_back(args);
|
argv.push_back(args);
|
||||||
|
|
||||||
std::string configFile =
|
std::string configFile =
|
||||||
@ -856,7 +856,7 @@ void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout,
|
|||||||
{
|
{
|
||||||
std::string totalCommandStr;
|
std::string totalCommandStr;
|
||||||
totalCommandStr =
|
totalCommandStr =
|
||||||
cmSystemTools::ConvertToOutputPath(command->GetCommand().c_str());
|
this->ConvertToRelativeOutputPath(command->GetCommand().c_str());
|
||||||
totalCommandStr += " ";
|
totalCommandStr += " ";
|
||||||
totalCommandStr += command->GetArguments();
|
totalCommandStr += command->GetArguments();
|
||||||
totalCommandStr += "\n";
|
totalCommandStr += "\n";
|
||||||
@ -1149,7 +1149,7 @@ std::string cmLocalVisualStudio7Generator::EscapeForXML(const char* s)
|
|||||||
|
|
||||||
std::string cmLocalVisualStudio7Generator::ConvertToXMLOutputPath(const char* path)
|
std::string cmLocalVisualStudio7Generator::ConvertToXMLOutputPath(const char* path)
|
||||||
{
|
{
|
||||||
std::string ret = cmSystemTools::ConvertToOutputPath(path);
|
std::string ret = this->ConvertToRelativeOutputPath(path);
|
||||||
cmSystemTools::ReplaceString(ret, "&", "&");
|
cmSystemTools::ReplaceString(ret, "&", "&");
|
||||||
cmSystemTools::ReplaceString(ret, "\"", """);
|
cmSystemTools::ReplaceString(ret, "\"", """);
|
||||||
cmSystemTools::ReplaceString(ret, "<", "<");
|
cmSystemTools::ReplaceString(ret, "<", "<");
|
||||||
@ -1159,7 +1159,7 @@ std::string cmLocalVisualStudio7Generator::ConvertToXMLOutputPath(const char* pa
|
|||||||
|
|
||||||
std::string cmLocalVisualStudio7Generator::ConvertToXMLOutputPathSingle(const char* path)
|
std::string cmLocalVisualStudio7Generator::ConvertToXMLOutputPathSingle(const char* path)
|
||||||
{
|
{
|
||||||
std::string ret = cmSystemTools::ConvertToOutputPath(path);
|
std::string ret = this->ConvertToRelativeOutputPath(path);
|
||||||
cmSystemTools::ReplaceString(ret, "\"", "");
|
cmSystemTools::ReplaceString(ret, "\"", "");
|
||||||
cmSystemTools::ReplaceString(ret, "&", "&");
|
cmSystemTools::ReplaceString(ret, "&", "&");
|
||||||
cmSystemTools::ReplaceString(ret, "<", "<");
|
cmSystemTools::ReplaceString(ret, "<", "<");
|
||||||
|
@ -1107,14 +1107,14 @@ std::string cmSystemTools::RelativePath(const char* local, const char* remote)
|
|||||||
std::vector<std::string> fileSplit = cmSystemTools::SplitString(local);
|
std::vector<std::string> fileSplit = cmSystemTools::SplitString(local);
|
||||||
std::vector<std::string> relativeSplit = cmSystemTools::SplitString(remote);
|
std::vector<std::string> relativeSplit = cmSystemTools::SplitString(remote);
|
||||||
// count up how many mathing directory names there are from the start
|
// count up how many mathing directory names there are from the start
|
||||||
int sameCount = 0;
|
unsigned int sameCount = 0;
|
||||||
while(sameCount < fileSplit.size()-1 && sameCount < relativeSplit.size()-1 &&
|
while(sameCount < fileSplit.size()-1 && sameCount < relativeSplit.size()-1 &&
|
||||||
fileSplit[sameCount] == relativeSplit[sameCount])
|
fileSplit[sameCount] == relativeSplit[sameCount])
|
||||||
{
|
{
|
||||||
sameCount++;
|
sameCount++;
|
||||||
}
|
}
|
||||||
// put in sameCount number of ../ into the path
|
// put in sameCount number of ../ into the path
|
||||||
int i;
|
unsigned int i;
|
||||||
for(i = sameCount; i < fileSplit.size(); ++i)
|
for(i = sameCount; i < fileSplit.size(); ++i)
|
||||||
{
|
{
|
||||||
relativePath += "../";
|
relativePath += "../";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user