ENH: closer to working with spaces in the path
This commit is contained in:
parent
809b32fe59
commit
6349735590
@ -549,6 +549,17 @@ cmDSPWriter::CreateTargetRules(const cmTarget &target,
|
|||||||
return customRuleCode;
|
return customRuleCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline std::string removeQuotes(const std::string& s)
|
||||||
|
{
|
||||||
|
if(s[0] == '\"' && s[s.size()-1] == '\"')
|
||||||
|
{
|
||||||
|
return s.substr(1, s.size()-2);
|
||||||
|
}
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void cmDSPWriter::WriteDSPHeader(std::ostream& fout, const char *libName,
|
void cmDSPWriter::WriteDSPHeader(std::ostream& fout, const char *libName,
|
||||||
const cmTarget &target,
|
const cmTarget &target,
|
||||||
std::vector<cmSourceGroup> &)
|
std::vector<cmSourceGroup> &)
|
||||||
@ -585,20 +596,22 @@ void cmDSPWriter::WriteDSPHeader(std::ostream& fout, const char *libName,
|
|||||||
}
|
}
|
||||||
std::string lpath =
|
std::string lpath =
|
||||||
cmSystemTools::ConvertToOutputPath(libPath.c_str());
|
cmSystemTools::ConvertToOutputPath(libPath.c_str());
|
||||||
|
std::string lpathIntDir = libPath + "$(INTDIR)";
|
||||||
|
lpathIntDir = cmSystemTools::ConvertToOutputPath(lpathIntDir.c_str());
|
||||||
if(pathEmitted.insert(lpath).second)
|
if(pathEmitted.insert(lpath).second)
|
||||||
{
|
{
|
||||||
libOptions += " /LIBPATH:\"";
|
libOptions += " /LIBPATH:";
|
||||||
|
libOptions += lpathIntDir;
|
||||||
|
libOptions += " ";
|
||||||
|
libOptions += " /LIBPATH:";
|
||||||
libOptions += lpath;
|
libOptions += lpath;
|
||||||
libOptions += "$(INTDIR)\" ";
|
libOptions += " ";
|
||||||
libOptions += " /LIBPATH:\"";
|
libMultiLineOptions += "# ADD LINK32 /LIBPATH:";
|
||||||
libOptions += lpath;
|
libMultiLineOptions += lpathIntDir;
|
||||||
libOptions += "\" ";
|
libMultiLineOptions += " ";
|
||||||
libMultiLineOptions += "# ADD LINK32 /LIBPATH:\"";
|
libMultiLineOptions += " /LIBPATH:";
|
||||||
libMultiLineOptions += lpath;
|
libMultiLineOptions += lpath;
|
||||||
libMultiLineOptions += "$(INTDIR)\" ";
|
libMultiLineOptions += " \n";
|
||||||
libMultiLineOptions += " /LIBPATH:\"";
|
|
||||||
libMultiLineOptions += lpath;
|
|
||||||
libMultiLineOptions += "\" \n";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(exePath.size())
|
if(exePath.size())
|
||||||
@ -610,47 +623,53 @@ void cmDSPWriter::WriteDSPHeader(std::ostream& fout, const char *libName,
|
|||||||
}
|
}
|
||||||
std::string lpath =
|
std::string lpath =
|
||||||
cmSystemTools::ConvertToOutputPath(exePath.c_str());
|
cmSystemTools::ConvertToOutputPath(exePath.c_str());
|
||||||
|
std::string lpathIntDir = exePath + "$(INTDIR)";
|
||||||
|
lpathIntDir = cmSystemTools::ConvertToOutputPath(lpathIntDir.c_str());
|
||||||
|
|
||||||
if(pathEmitted.insert(lpath).second)
|
if(pathEmitted.insert(lpath).second)
|
||||||
{
|
{
|
||||||
libOptions += " /LIBPATH:\"";
|
libOptions += " /LIBPATH:";
|
||||||
|
libOptions += lpathIntDir;
|
||||||
|
libOptions += " ";
|
||||||
|
libOptions += " /LIBPATH:";
|
||||||
libOptions += lpath;
|
libOptions += lpath;
|
||||||
libOptions += "$(INTDIR)\" ";
|
libOptions += " ";
|
||||||
libOptions += " /LIBPATH:\"";
|
libMultiLineOptions += "# ADD LINK32 /LIBPATH:";
|
||||||
libOptions += lpath;
|
libMultiLineOptions += lpathIntDir;
|
||||||
libOptions += "\" ";
|
libMultiLineOptions += " ";
|
||||||
libMultiLineOptions += "# ADD LINK32 /LIBPATH:\"";
|
libMultiLineOptions += " /LIBPATH:";
|
||||||
libMultiLineOptions += lpath;
|
libMultiLineOptions += lpath;
|
||||||
libMultiLineOptions += "$(INTDIR)\" ";
|
libMultiLineOptions += " \n";
|
||||||
libMultiLineOptions += " /LIBPATH:\"";
|
|
||||||
libMultiLineOptions += lpath;
|
|
||||||
libMultiLineOptions += "\" \n";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::vector<std::string>::iterator i;
|
std::vector<std::string>::iterator i;
|
||||||
std::vector<std::string>& libdirs = m_Makefile->GetLinkDirectories();
|
std::vector<std::string>& libdirs = m_Makefile->GetLinkDirectories();
|
||||||
for(i = libdirs.begin(); i != libdirs.end(); ++i)
|
for(i = libdirs.begin(); i != libdirs.end(); ++i)
|
||||||
{
|
{
|
||||||
std::string lpath =
|
std::string path = *i;
|
||||||
cmSystemTools::ConvertToOutputPath(i->c_str());
|
if(path[path.size()-1] != '/')
|
||||||
if(lpath[lpath.size()-1] != '/')
|
|
||||||
{
|
{
|
||||||
lpath += "/";
|
path += "/";
|
||||||
}
|
}
|
||||||
|
std::string lpath =
|
||||||
|
cmSystemTools::ConvertToOutputPath(path.c_str());
|
||||||
|
std::string lpathIntDir = path + "$(INTDIR)";
|
||||||
|
lpathIntDir = cmSystemTools::ConvertToOutputPath(lpathIntDir.c_str());
|
||||||
if(pathEmitted.insert(lpath).second)
|
if(pathEmitted.insert(lpath).second)
|
||||||
{
|
{
|
||||||
libOptions += " /LIBPATH:\"";
|
libOptions += " /LIBPATH:";
|
||||||
|
libOptions += lpathIntDir;
|
||||||
|
libOptions += " ";
|
||||||
|
libOptions += " /LIBPATH:";
|
||||||
libOptions += lpath;
|
libOptions += lpath;
|
||||||
libOptions += "/$(INTDIR)\" ";
|
libOptions += " ";
|
||||||
libOptions += " /LIBPATH:\"";
|
|
||||||
libOptions += lpath;
|
|
||||||
libOptions += "\" ";
|
|
||||||
|
|
||||||
libMultiLineOptions += "# ADD LINK32 /LIBPATH:\"";
|
libMultiLineOptions += "# ADD LINK32 /LIBPATH:";
|
||||||
|
libMultiLineOptions += lpathIntDir;
|
||||||
|
libMultiLineOptions += " ";
|
||||||
|
libMultiLineOptions += " /LIBPATH:";
|
||||||
libMultiLineOptions += lpath;
|
libMultiLineOptions += lpath;
|
||||||
libMultiLineOptions += "/$(INTDIR)\" ";
|
libMultiLineOptions += " \n";
|
||||||
libMultiLineOptions += " /LIBPATH:\"";
|
|
||||||
libMultiLineOptions += lpath;
|
|
||||||
libMultiLineOptions += "\" \n";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -754,10 +773,16 @@ void cmDSPWriter::WriteDSPHeader(std::ostream& fout, const char *libName,
|
|||||||
cmSystemTools::ReplaceString(line, "BUILD_INCLUDES",
|
cmSystemTools::ReplaceString(line, "BUILD_INCLUDES",
|
||||||
m_IncludeOptions.c_str());
|
m_IncludeOptions.c_str());
|
||||||
cmSystemTools::ReplaceString(line, "OUTPUT_LIBNAME",libName);
|
cmSystemTools::ReplaceString(line, "OUTPUT_LIBNAME",libName);
|
||||||
|
// because LIBRARY_OUTPUT_PATH and EXECUTABLE_OUTPUT_PATH
|
||||||
|
// are already quoted in the template file,
|
||||||
|
// we need to remove the quotes here, we still need
|
||||||
|
// to convert to output path for unix to win32 conversion
|
||||||
cmSystemTools::ReplaceString(line, "LIBRARY_OUTPUT_PATH",
|
cmSystemTools::ReplaceString(line, "LIBRARY_OUTPUT_PATH",
|
||||||
cmSystemTools::ConvertToOutputPath(libPath.c_str()).c_str());
|
removeQuotes(
|
||||||
|
cmSystemTools::ConvertToOutputPath(libPath.c_str())).c_str());
|
||||||
cmSystemTools::ReplaceString(line, "EXECUTABLE_OUTPUT_PATH",
|
cmSystemTools::ReplaceString(line, "EXECUTABLE_OUTPUT_PATH",
|
||||||
cmSystemTools::ConvertToOutputPath(exePath.c_str()).c_str());
|
removeQuotes(
|
||||||
|
cmSystemTools::ConvertToOutputPath(exePath.c_str())).c_str());
|
||||||
cmSystemTools::ReplaceString(line,
|
cmSystemTools::ReplaceString(line,
|
||||||
"EXTRA_DEFINES",
|
"EXTRA_DEFINES",
|
||||||
m_Makefile->GetDefineFlags());
|
m_Makefile->GetDefineFlags());
|
||||||
|
@ -64,6 +64,16 @@ void cmDSWWriter::OutputDSWFile()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline std::string removeQuotes(const std::string& s)
|
||||||
|
{
|
||||||
|
if(s[0] == '\"' && s[s.size()-1] == '\"')
|
||||||
|
{
|
||||||
|
return s.substr(1, s.size()-2);
|
||||||
|
}
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Write a DSW file to the stream
|
// Write a DSW file to the stream
|
||||||
void cmDSWWriter::WriteDSWFile(std::ostream& fout)
|
void cmDSWWriter::WriteDSWFile(std::ostream& fout)
|
||||||
{
|
{
|
||||||
@ -81,6 +91,7 @@ void cmDSWWriter::WriteDSWFile(std::ostream& fout)
|
|||||||
m_Makefile->AddUtilityCommand("ALL_BUILD", "echo", "\"Build all projects\"",
|
m_Makefile->AddUtilityCommand("ALL_BUILD", "echo", "\"Build all projects\"",
|
||||||
false);
|
false);
|
||||||
std::string ctest = m_Makefile->GetDefinition("CMAKE_COMMAND");
|
std::string ctest = m_Makefile->GetDefinition("CMAKE_COMMAND");
|
||||||
|
ctest = removeQuotes(ctest);
|
||||||
ctest = cmSystemTools::GetFilenamePath(ctest.c_str());
|
ctest = cmSystemTools::GetFilenamePath(ctest.c_str());
|
||||||
ctest += "/";
|
ctest += "/";
|
||||||
ctest += "ctest";
|
ctest += "ctest";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user