Commit 8c3400dc authored by Bill Hoffman's avatar Bill Hoffman
Browse files

ENH: big change in the path handling, one function CreateOutputPath is used to...

ENH: big change in the path handling, one function CreateOutputPath is used to escape spaces and convert to the native path type
parent bfcf4b02
......@@ -101,18 +101,18 @@ void cmBorlandMakefileGenerator::OutputMakeVariables(std::ostream& fout)
m_Makefile->ExpandVariablesInString(replaceVars);
std::string ccompiler = m_Makefile->GetDefinition("CMAKE_C_COMPILER");
cmSystemTools::ConvertToWindowsSlashes(ccompiler);
fout << "CMAKE_C_COMPILER = " << cmSystemTools::EscapeSpaces(ccompiler.c_str())
fout << "CMAKE_C_COMPILER = "
<< this->ConvertToOutputPath(ccompiler.c_str())
<< "\n";
std::string cxxcompiler = m_Makefile->GetDefinition("CMAKE_CXX_COMPILER");
cmSystemTools::ConvertToWindowsSlashes(cxxcompiler);
fout << "CMAKE_CXX_COMPILER = " << cmSystemTools::EscapeSpaces(cxxcompiler.c_str())
fout << "CMAKE_CXX_COMPILER = "
<< this->ConvertToOutputPath(cxxcompiler.c_str())
<< "\n";
std::string cmakecommand = m_Makefile->GetDefinition("CMAKE_COMMAND");
cmSystemTools::ConvertToWindowsSlashes(cmakecommand);
fout << "CMAKE_COMMAND = " << cmSystemTools::EscapeSpaces(cmakecommand.c_str()) << "\n";
fout << "CMAKE_COMMAND = "
<< this->ConvertToOutputPath(cmakecommand.c_str()) << "\n";
fout << replaceVars.c_str();
fout << "CMAKE_CURRENT_SOURCE = "
......@@ -130,17 +130,15 @@ void cmBorlandMakefileGenerator::OutputMakeVariables(std::ostream& fout)
fout << "INCLUDE_FLAGS = ";
std::vector<std::string>& includes = m_Makefile->GetIncludeDirectories();
std::vector<std::string>::iterator i;
fout << "-I" << cmSystemTools::EscapeSpaces(m_Makefile->GetStartDirectory()) << " ";
fout << "-I" <<
this->ConvertToOutputPath(m_Makefile->GetStartDirectory()) << " ";
for(i = includes.begin(); i != includes.end(); ++i)
{
std::string include = *i;
// Don't output a -I for the standard include path "/usr/include".
// This can cause problems with certain standard library
// implementations because the wrong headers may be found first.
if(include != "/usr/include")
{
fout << "-I" << cmSystemTools::EscapeSpaces(i->c_str()).c_str() << " ";
}
fout << "-I" << this->ConvertToOutputPath(i->c_str()).c_str() << " ";
}
fout << m_Makefile->GetDefineFlags();
fout << "\n\n";
......@@ -168,7 +166,7 @@ OutputBuildObjectFromSource(std::ostream& fout,
std::string comment = "Build ";
std::string objectFile = std::string(shortName) +
this->GetOutputExtension(source.GetSourceExtension().c_str());
cmSystemTools::ConvertToWindowsSlashes(objectFile);
objectFile = this->ConvertToOutputPath(objectFile.c_str());
comment += objectFile + " From ";
comment += source.GetFullPath();
std::string compileCommand;
......@@ -185,7 +183,7 @@ OutputBuildObjectFromSource(std::ostream& fout,
compileCommand += objectFile;
compileCommand += " $(INCLUDE_FLAGS) -c ";
compileCommand +=
cmSystemTools::EscapeSpaces(source.GetFullPath().c_str());
this->ConvertToOutputPath(source.GetFullPath().c_str());
}
else if (ext == "rc")
{
......@@ -193,7 +191,7 @@ OutputBuildObjectFromSource(std::ostream& fout,
compileCommand += objectFile;
compileCommand += "\" ";
compileCommand +=
cmSystemTools::EscapeSpaces(source.GetFullPath().c_str());
this->ConvertToOutputPath(source.GetFullPath().c_str());
}
else if (ext == "def")
{
......@@ -213,12 +211,12 @@ OutputBuildObjectFromSource(std::ostream& fout,
compileCommand += objectFile;
compileCommand += " $(INCLUDE_FLAGS) -c ";
compileCommand +=
cmSystemTools::EscapeSpaces(source.GetFullPath().c_str());
this->ConvertToOutputPath(source.GetFullPath().c_str());
}
this->OutputMakeRule(fout,
comment.c_str(),
objectFile.c_str(),
cmSystemTools::EscapeSpaces(
this->ConvertToOutputPath(
source.GetFullPath().c_str()).c_str(),
compileCommand.c_str());
}
......@@ -230,10 +228,8 @@ void cmBorlandMakefileGenerator::OutputSharedLibraryRule(std::ostream& fout,
std::string target = m_LibraryOutputPath + name;
std::string libpath = target + ".lib";
target += ".dll";
cmSystemTools::ConvertToWindowsSlashes(libpath);
cmSystemTools::ConvertToWindowsSlashes(target);
target = cmSystemTools::EscapeSpaces(target.c_str());
libpath = cmSystemTools::EscapeSpaces(libpath.c_str());
target = this->ConvertToOutputPath(target.c_str());
libpath = this->ConvertToOutputPath(libpath.c_str());
std::string depend = "$(";
depend += this->CreateMakeVariable(name, "_SRC_OBJS");
depend += ") $(" + this->CreateMakeVariable(name, "_DEPEND_LIBS") + ")";
......@@ -290,8 +286,7 @@ void cmBorlandMakefileGenerator::OutputStaticLibraryRule(std::ostream& fout,
const cmTarget &t)
{
std::string target = m_LibraryOutputPath + std::string(name) + ".lib";
cmSystemTools::ConvertToWindowsSlashes(target);
target = cmSystemTools::EscapeSpaces(target.c_str());
target = this->ConvertToOutputPath(target.c_str());
std::string depend = "$(";
depend += this->CreateMakeVariable(name, "_SRC_OBJS") + ") ";
std::string command = "tlib @&&|\n\t /p512 /a ";
......@@ -326,8 +321,7 @@ void cmBorlandMakefileGenerator::OutputExecutableRule(std::ostream& fout,
const cmTarget &t)
{
std::string target = m_ExecutableOutputPath + name + m_ExecutableExtension;
cmSystemTools::ConvertToWindowsSlashes(target);
target = cmSystemTools::EscapeSpaces(target.c_str());
target = this->ConvertToOutputPath(target.c_str());
std::string depend = "$(";
depend += this->CreateMakeVariable(name, "_SRC_OBJS") + ") $(" +
this->CreateMakeVariable(name, "_DEPEND_LIBS") + ")";
......
......@@ -48,8 +48,7 @@ void cmDSPWriter::OutputDSPFile()
for(i = includes.begin(); i != includes.end(); ++i)
{
m_IncludeOptions += " /I ";
std::string tmp = cmSystemTools::EscapeSpaces(i->c_str());
cmSystemTools::ConvertToWindowsSlashesAndCleanUp(tmp);
std::string tmp = cmSystemTools::ConvertToOutputPath(i->c_str());
// quote if not already quoted
if (tmp[0] != '"')
......@@ -147,20 +146,23 @@ void cmDSPWriter::AddDSPBuildRule(cmSourceGroup& sourceGroup)
std::string makefileIn = m_Makefile->GetStartDirectory();
makefileIn += "/";
makefileIn += "CMakeLists.txt";
makefileIn = cmSystemTools::HandleNetworkPaths(makefileIn.c_str());
makefileIn = cmSystemTools::EscapeSpaces(makefileIn.c_str());
makefileIn = cmSystemTools::ConvertToOutputPath(makefileIn.c_str());
std::string dsprule = "${CMAKE_COMMAND}";
m_Makefile->ExpandVariablesInString(dsprule);
dsprule = cmSystemTools::HandleNetworkPaths(dsprule.c_str());
dsprule = cmSystemTools::ConvertToOutputPath(dsprule.c_str());
std::string args = makefileIn;
args += " -H\"";
args += cmSystemTools::HandleNetworkPaths(m_Makefile->GetHomeDirectory());
args +=
cmSystemTools::ConvertToOutputPath(m_Makefile->GetHomeDirectory());
args += "\" -S\"";
args += cmSystemTools::HandleNetworkPaths(m_Makefile->GetStartDirectory());
args +=
cmSystemTools::ConvertToOutputPath(m_Makefile->GetStartDirectory());
args += "\" -O\"";
args += cmSystemTools::HandleNetworkPaths(m_Makefile->GetStartOutputDirectory());
args +=
cmSystemTools::ConvertToOutputPath(m_Makefile->GetStartOutputDirectory());
args += "\" -B\"";
args += cmSystemTools::HandleNetworkPaths(m_Makefile->GetHomeOutputDirectory());
args +=
cmSystemTools::ConvertToOutputPath(m_Makefile->GetHomeOutputDirectory());
args += "\"";
m_Makefile->ExpandVariablesInString(args);
......@@ -268,7 +270,8 @@ void cmDSPWriter::WriteDSPFile(std::ostream& fout,
// Tell MS-Dev what the source is. If the compiler knows how to
// build it, then it will.
fout << "SOURCE=" << cmSystemTools::EscapeSpaces(source.c_str()) << "\n\n";
fout << "SOURCE=" <<
cmSystemTools::ConvertToOutputPath(source.c_str()) << "\n\n";
if (!commands.empty())
{
cmSourceGroup::CommandFiles totalCommand;
......@@ -315,12 +318,11 @@ void cmDSPWriter::WriteCustomRule(std::ostream& fout,
// Write out the dependencies for the rule.
fout << "USERDEP__HACK=";
std::string temp;
for(std::set<std::string>::const_iterator d = depends.begin();
d != depends.end(); ++d)
{
temp = *d;
fout << "\\\n\t" << cmSystemTools::EscapeSpaces(cmSystemTools::ConvertToWindowsSlashes(temp));
fout << "\\\n\t" <<
cmSystemTools::ConvertToOutputPath(d->c_str());
}
fout << "\n";
......@@ -455,8 +457,7 @@ cmDSPWriter::CombineCommands(const cmSourceGroup::Commands &commands,
{
totalCommandStr += "\n\t";
temp= c->second.m_Command;
cmSystemTools::ConvertToWindowsSlashes(temp);
temp = cmSystemTools::EscapeSpaces(temp.c_str());
temp = cmSystemTools::ConvertToOutputPath(temp.c_str());
totalCommandStr += temp;
totalCommandStr += " ";
totalCommandStr += c->second.m_Arguments;
......@@ -556,7 +557,8 @@ void cmDSPWriter::WriteDSPHeader(std::ostream& fout, const char *libName,
{
libPath += "/";
}
std::string lpath = cmSystemTools::HandleNetworkPaths(libPath.c_str());
std::string lpath =
cmSystemTools::ConvertToOutputPath(libPath.c_str());
if(pathEmitted.insert(lpath).second)
{
libOptions += " /LIBPATH:\"";
......@@ -580,7 +582,8 @@ void cmDSPWriter::WriteDSPHeader(std::ostream& fout, const char *libName,
{
exePath += "/";
}
std::string lpath = cmSystemTools::HandleNetworkPaths(exePath.c_str());
std::string lpath =
cmSystemTools::ConvertToOutputPath(exePath.c_str());
if(pathEmitted.insert(lpath).second)
{
libOptions += " /LIBPATH:\"";
......@@ -601,7 +604,8 @@ void cmDSPWriter::WriteDSPHeader(std::ostream& fout, const char *libName,
std::vector<std::string>& libdirs = m_Makefile->GetLinkDirectories();
for(i = libdirs.begin(); i != libdirs.end(); ++i)
{
std::string lpath = cmSystemTools::HandleNetworkPaths(i->c_str());
std::string lpath =
cmSystemTools::ConvertToOutputPath(i->c_str());
if(lpath[lpath.size()-1] != '/')
{
lpath += "/";
......@@ -640,7 +644,7 @@ void cmDSPWriter::WriteDSPHeader(std::ostream& fout, const char *libName,
{
lib += ".lib";
}
lib = cmSystemTools::EscapeSpaces(lib.c_str());
lib = cmSystemTools::ConvertToOutputPath(lib.c_str());
if (j->second == cmTarget::GENERAL)
{
......@@ -725,9 +729,9 @@ void cmDSPWriter::WriteDSPHeader(std::ostream& fout, const char *libName,
m_IncludeOptions.c_str());
cmSystemTools::ReplaceString(line, "OUTPUT_LIBNAME",libName);
cmSystemTools::ReplaceString(line, "LIBRARY_OUTPUT_PATH",
cmSystemTools::HandleNetworkPaths(libPath.c_str()).c_str());
cmSystemTools::ConvertToOutputPath(libPath.c_str()).c_str());
cmSystemTools::ReplaceString(line, "EXECUTABLE_OUTPUT_PATH",
cmSystemTools::HandleNetworkPaths(exePath.c_str()).c_str());
cmSystemTools::ConvertToOutputPath(exePath.c_str()).c_str());
cmSystemTools::ReplaceString(line,
"EXTRA_DEFINES",
m_Makefile->GetDefineFlags());
......
......@@ -34,7 +34,7 @@ bool cmExecProgramCommand::InitialPass(std::vector<std::string> const& argsIn)
cmSystemTools::MakeDirectory(args[1].c_str());
std::string command;
command = "cd ";
command += args[1].c_str();
command += cmSystemTools::ConvertToOutputPath(args[1].c_str());
command += " && ";
command += args[0].c_str();
cmSystemTools::RunCommand(command.c_str(), output);
......
......@@ -306,8 +306,7 @@ void cmMSDotNETGenerator::WriteProject(std::ostream& fout,
const cmTarget& target
)
{
std::string d = dir;
cmSystemTools::ConvertToWindowsSlashes(d);
std::string d = cmSystemTools::ConvertToOutputPath(dir);
fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\" = \""
<< dspname << "\", \""
<< d << "\\" << dspname << ".vcproj\", \"{"
......@@ -485,7 +484,8 @@ void cmMSDotNETGenerator::OutputVCProjFile()
{
m_LibraryOutputPath += "/";
}
m_LibraryOutputPath = cmSystemTools::HandleNetworkPaths(m_LibraryOutputPath.c_str());
m_LibraryOutputPath =
cmSystemTools::ConvertToOutputPath(m_LibraryOutputPath.c_str());
}
m_ExecutableOutputPath = "";
if (m_Makefile->GetDefinition("EXECUTABLE_OUTPUT_PATH"))
......@@ -500,14 +500,14 @@ void cmMSDotNETGenerator::OutputVCProjFile()
m_ExecutableOutputPath += "/";
}
}
m_ExecutableOutputPath = cmSystemTools::HandleNetworkPaths(m_ExecutableOutputPath.c_str());
m_ExecutableOutputPath =
cmSystemTools::ConvertToOutputPath(m_ExecutableOutputPath.c_str());
std::vector<std::string>& includes = m_Makefile->GetIncludeDirectories();
std::vector<std::string>::iterator i;
for(i = includes.begin(); i != includes.end(); ++i)
{
std::string tmp = cmSystemTools::EscapeSpaces(i->c_str());
cmSystemTools::ConvertToWindowsSlashesAndCleanUp(tmp);
std::string tmp = cmSystemTools::ConvertToOutputPath(i->c_str());
m_IncludeOptions += ",";
// quote if not already quoted
if (tmp[0] != '"')
......@@ -578,20 +578,23 @@ void cmMSDotNETGenerator::AddVCProjBuildRule(cmSourceGroup& sourceGroup)
std::string makefileIn = m_Makefile->GetStartDirectory();
makefileIn += "/";
makefileIn += "CMakeLists.txt";
makefileIn = cmSystemTools::HandleNetworkPaths(makefileIn.c_str());
makefileIn = cmSystemTools::EscapeSpaces(makefileIn.c_str());
makefileIn = cmSystemTools::ConvertToOutputPath(makefileIn.c_str());
std::string dsprule = "${CMAKE_COMMAND}";
m_Makefile->ExpandVariablesInString(dsprule);
dsprule = cmSystemTools::HandleNetworkPaths(dsprule.c_str());
dsprule = cmSystemTools::ConvertToOutputPath(dsprule.c_str());
std::string args = makefileIn;
args += " -H\"";
args += cmSystemTools::HandleNetworkPaths(m_Makefile->GetHomeDirectory());
args +=
cmSystemTools::ConvertToOutputPath(m_Makefile->GetHomeDirectory());
args += "\" -S\"";
args += cmSystemTools::HandleNetworkPaths(m_Makefile->GetStartDirectory());
args +=
cmSystemTools::ConvertToOutputPath(m_Makefile->GetStartDirectory());
args += "\" -O\"";
args += cmSystemTools::HandleNetworkPaths(m_Makefile->GetStartOutputDirectory());
args +=
cmSystemTools::ConvertToOutputPath(m_Makefile->GetStartOutputDirectory());
args += "\" -B\"";
args += cmSystemTools::HandleNetworkPaths(m_Makefile->GetHomeOutputDirectory());
args +=
cmSystemTools::ConvertToOutputPath(m_Makefile->GetHomeOutputDirectory());
args += "\"";
m_Makefile->ExpandVariablesInString(args);
......@@ -824,7 +827,7 @@ void cmMSDotNETGenerator::OutputLibraryDirectories(std::ostream& fout,
std::vector<std::string>& libdirs = m_Makefile->GetLinkDirectories();
for(i = libdirs.begin(); i != libdirs.end(); ++i)
{
std::string lpath = cmSystemTools::HandleNetworkPaths(i->c_str());
std::string lpath = cmSystemTools::ConvertToOutputPath(i->c_str());
if(lpath[lpath.size()-1] != '/')
{
lpath += "/";
......@@ -855,7 +858,7 @@ void cmMSDotNETGenerator::OutputLibraries(std::ostream& fout,
{
lib += ".lib";
}
lib = cmSystemTools::EscapeSpaces(lib.c_str());
lib = cmSystemTools::ConvertToOutputPath(lib.c_str());
if (j->second == cmTarget::GENERAL
|| (j->second == cmTarget::DEBUG && strcmp(configName, "DEBUG") == 0)
|| (j->second == cmTarget::OPTIMIZED && strcmp(configName, "DEBUG") != 0))
......@@ -968,11 +971,10 @@ void cmMSDotNETGenerator::WriteVCProjFile(std::ostream& fout,
if (source != libName || target.GetType() == cmTarget::UTILITY)
{
fout << "\t\t\t<File\n";
std::string d = source;
cmSystemTools::ConvertToWindowsSlashes(d);
std::string d = cmSystemTools::ConvertToOutputPath(source.c_str());
// Tell MS-Dev what the source is. If the compiler knows how to
// build it, then it will.
fout << "\t\t\t\tRelativePath=\"" << cmSystemTools::EscapeSpaces(d.c_str()) << "\">\n";
fout << "\t\t\t\tRelativePath=\"" << d << "\">\n";
if (!commands.empty())
{
cmSourceGroup::CommandFiles totalCommand;
......@@ -1022,8 +1024,7 @@ void cmMSDotNETGenerator::WriteCustomRule(std::ostream& fout,
for(std::set<std::string>::const_iterator d = depends.begin();
d != depends.end(); ++d)
{
temp = *d;
fout << cmSystemTools::EscapeSpaces(cmSystemTools::ConvertToWindowsSlashes(temp))
fout << cmSystemTools::ConvertToOutputPath(d->c_str())
<< ";";
}
fout << "\"\n";
......@@ -1087,9 +1088,8 @@ cmMSDotNETGenerator::CombineCommands(const cmSourceGroup::Commands &commands,
for(cmSourceGroup::Commands::const_iterator c = commands.begin();
c != commands.end(); ++c)
{
temp= c->second.m_Command;
cmSystemTools::ConvertToWindowsSlashes(temp);
temp = cmSystemTools::EscapeSpaces(temp.c_str());
temp=
cmSystemTools::ConvertToOutputPath(c->second.m_Command.c_str());
totalCommandStr += temp;
totalCommandStr += " ";
totalCommandStr += c->second.m_Arguments;
......
......@@ -44,11 +44,11 @@ cmNMakeMakefileGenerator::~cmNMakeMakefileGenerator()
std::string cmNMakeMakefileGenerator::ShortPath(const char* path)
{
std::string ret = path;
cmSystemTools::ConvertToWindowsSlashes(ret);
// if there are no spaces in path, then just return path
// if there are no spaces in path, then just
// call ConvertToOutputPath
if(ret.find(' ') == std::string::npos)
{
return ret;
return this->ConvertToOutputPath(path);
}
// if there are spaces then call GetShortPathName to get rid of them
......@@ -61,8 +61,8 @@ std::string cmNMakeMakefileGenerator::ShortPath(const char* path)
else
{
// if GetShortPathName failed for some reason use
// EscapeSpaces instead
ret = cmSystemTools::EscapeSpaces(path);
// ConvertToOutputPath instead which will at least escape the spaces
ret = this->ConvertToOutputPath(path);
}
delete [] buffer;
return ret;
......@@ -87,7 +87,7 @@ std::string cmNMakeMakefileGenerator::ShortPathCommand(const char* command)
{
c = removeIntDir.match(1) + removeIntDir.match(2);
}
c = ShortPath(c.c_str());
c = this->ShortPath(c.c_str());
std::string ret = c;
std::string args = reg.match(2);
ret += args;
......@@ -159,24 +159,24 @@ void cmNMakeMakefileGenerator::OutputMakeVariables(std::ostream& fout)
fout << replaceVars.c_str();
std::string ccompiler = m_Makefile->GetDefinition("CMAKE_C_COMPILER");
cmSystemTools::ConvertToWindowsSlashes(ccompiler);
fout << "CMAKE_C_COMPILER = " << cmSystemTools::EscapeSpaces(ccompiler.c_str()) << "\n";
fout << "CMAKE_C_COMPILER = "
<< this->ConvertToOutputPath(ccompiler.c_str()) << "\n";
std::string cxxcompiler = m_Makefile->GetDefinition("CMAKE_CXX_COMPILER");
cmSystemTools::ConvertToWindowsSlashes(cxxcompiler);
fout << "CMAKE_CXX_COMPILER = " << cmSystemTools::EscapeSpaces(cxxcompiler.c_str()) << "\n";
fout << "CMAKE_CXX_COMPILER = "
<< this->ConvertToOutputPath(cxxcompiler.c_str()) << "\n";
std::string linker = m_Makefile->GetDefinition("CMAKE_LINKER");
cmSystemTools::ConvertToWindowsSlashes(linker);
fout << "CMAKE_LINKER = " << cmSystemTools::EscapeSpaces(linker.c_str()) << "\n";
fout << "CMAKE_LINKER = " <<
this->ConvertToOutputPath(linker.c_str()) << "\n";
std::string lib_manager = m_Makefile->GetDefinition("CMAKE_LIBRARY_MANAGER");
cmSystemTools::ConvertToWindowsSlashes(lib_manager);
fout << "CMAKE_LIBRARY_MANAGER = " << cmSystemTools::EscapeSpaces(lib_manager.c_str()) << "\n";
fout << "CMAKE_LIBRARY_MANAGER = "
<< this->ConvertToOutputPath(lib_manager.c_str()) << "\n";
std::string cmakecommand = m_Makefile->GetDefinition("CMAKE_COMMAND");
cmSystemTools::ConvertToWindowsSlashes(cmakecommand);
fout << "CMAKE_COMMAND = " << cmSystemTools::EscapeSpaces(cmakecommand.c_str()) << "\n";
fout << "CMAKE_COMMAND = "
<< this->ConvertToOutputPath(cmakecommand.c_str()) << "\n";
fout << "CMAKE_CURRENT_SOURCE = "
<< ShortPath(m_Makefile->GetStartDirectory() )
......@@ -194,17 +194,15 @@ void cmNMakeMakefileGenerator::OutputMakeVariables(std::ostream& fout)
fout << "INCLUDE_FLAGS = ";
std::vector<std::string>& includes = m_Makefile->GetIncludeDirectories();
std::vector<std::string>::iterator i;
fout << "-I" << cmSystemTools::EscapeSpaces(m_Makefile->GetStartDirectory()) << " ";
fout << "-I" <<
this->ConvertToOutputPath(m_Makefile->GetStartDirectory()) << " ";
for(i = includes.begin(); i != includes.end(); ++i)
{
std::string include = *i;
// Don't output a -I for the standard include path "/usr/include".
// This can cause problems with certain standard library
// implementations because the wrong headers may be found first.
if(include != "/usr/include")
{
fout << "-I" << cmSystemTools::EscapeSpaces(i->c_str()).c_str() << " ";
}
fout << "-I" << this->ConvertToOutputPath(i->c_str()).c_str() << " ";
}
fout << m_Makefile->GetDefineFlags();
......@@ -219,9 +217,7 @@ void cmNMakeMakefileGenerator::BuildInSubDirectory(std::ostream& fout,
{
if(target1)
{
std::string dir = directory;
cmSystemTools::ConvertToWindowsSlashes(dir);
dir = cmSystemTools::EscapeSpaces(dir.c_str());
std::string dir = this->ConvertToOutputPath(directory);
fout << "\tif not exist \"" << dir << "\\$(NULL)\""
<< " "
<< "$(MAKE) $(MAKESILENT) rebuild_cache\n"
......@@ -235,8 +231,7 @@ void cmNMakeMakefileGenerator::BuildInSubDirectory(std::ostream& fout,
fout << "\t$(MAKE) -$(MAKEFLAGS) $(MAKESILENT) " << target2 << "\n";
}
std::string currentDir = m_Makefile->GetCurrentOutputDirectory();
cmSystemTools::ConvertToWindowsSlashes(currentDir);
fout << "\tcd " << cmSystemTools::EscapeSpaces(currentDir.c_str()) << "\n\n";
fout << "\tcd " << this->ConvertToOutputPath(currentDir.c_str()) << "\n\n";
}
......@@ -272,7 +267,7 @@ void cmNMakeMakefileGenerator::OutputMakeRule(std::ostream& fout,
fout << "\n";
replace = target;
m_Makefile->ExpandVariablesInString(replace);
replace = cmSystemTools::EscapeSpaces(replace.c_str());
replace = this->ConvertToOutputPath(replace.c_str());
fout << replace.c_str() << ": ";
if(depends)
{
......@@ -358,7 +353,7 @@ OutputBuildObjectFromSource(std::ostream& fout,
}
compileCommand += "$(INCLUDE_FLAGS) -c ";
compileCommand +=
cmSystemTools::EscapeSpaces(source.GetFullPath().c_str());
this->ConvertToOutputPath(source.GetFullPath().c_str());
// Need to get the definition here because this value might have
// trailing space (since it is directly prepended to the filename)
......@@ -375,7 +370,7 @@ OutputBuildObjectFromSource(std::ostream& fout,
compileCommand += objectFile;
compileCommand += "\" ";
compileCommand +=
cmSystemTools::EscapeSpaces(source.GetFullPath().c_str());
this->ConvertToOutputPath(source.GetFullPath().c_str());
}
else if (ext == "def")
{
......@@ -394,7 +389,7 @@ OutputBuildObjectFromSource(std::ostream& fout,
}
compileCommand += "$(INCLUDE_FLAGS) -c ";
compileCommand +=
cmSystemTools::EscapeSpaces(source.GetFullPath().c_str());
this->ConvertToOutputPath(source.GetFullPath().c_str());
// Need to get the definition here because this value might have
// trailing space (since it is directly prepended to the filename)
......@@ -409,7 +404,7 @@ OutputBuildObjectFromSource(std::ostream& fout,
this->OutputMakeRule(fout,
comment.c_str(),
objectFile.c_str(),
cmSystemTools::EscapeSpaces(
this->ConvertToOutputPath(
source.GetFullPath().c_str()).c_str(),
compileCommand.c_str());
}
......@@ -440,7 +435,7 @@ void cmNMakeMakefileGenerator::OutputSharedLibraryRule(std::ostream& fout,
command += " $(CMAKE_LINKER_FLAGS) " + linker_output_file_flag;
std::string dllpath = m_LibraryOutputPath + std::string(name) + m_SharedLibraryExtension;
command += cmSystemTools::EscapeSpaces(dllpath.c_str());
command += this->ConvertToOutputPath(dllpath.c_str());
command += " $(" + this->CreateMakeVariable(name, "_SRC_OBJS") + ") ";
......@@ -503,7 +498,7 @@ void cmNMakeMakefileGenerator::OutputStaticLibraryRule(std::ostream& fout,
std::string command = "$(CMAKE_LIBRARY_MANAGER) $(CMAKE_LIBRARY_MANAGER_FLAGS) @<<\n\t " + library_manager_output_file_flag;
std::string libpath = m_LibraryOutputPath + std::string(name) + m_StaticLibraryExtension;
command += cmSystemTools::EscapeSpaces(libpath.c_str());
command += this->ConvertToOutputPath(libpath.c_str());
command += " $(";
command += this->CreateMakeVariable(name, "_SRC_OBJS") + ")";
......@@ -546,7 +541,7 @@ void cmNMakeMakefileGenerator::OutputExecutableRule(std::ostream& fout,
m_Makefile->ExpandVariablesInString(output_executable_file_flag);
command += " " + output_executable_file_flag +
cmSystemTools::EscapeSpaces(path.c_str());
this->ConvertToOutputPath(path.c_str());
command += " $(CMAKE_C_LINK_EXECUTABLE_FLAG) ";
if(t.GetType() == cmTarget::WIN32_EXECUTABLE)
......@@ -605,7 +600,7 @@ void cmNMakeMakefileGenerator::OutputLinkLibraries(std::ostream& fout,
if(emitted.insert(libpath).second)
{
linkLibs += lib_path_opt;
cmSystemTools::ConvertToWindowsSlashes(libpath);
this->ConvertToOutputPath(libpath.c_str());
linkLibs += libpath;
linkLibs += " ";
}
......@@ -698,26 +693,21 @@ void cmNMakeMakefileGenerator::OutputBuildLibraryInDir(std::ostream& fout,
const char* fullpath)
{
std::string currentDir = m_Makefile->GetCurrentOutputDirectory();
cmSystemTools::ConvertToWindowsSlashes(currentDir);
std::string wpath = cmSystemTools::EscapeSpaces(path);
cmSystemTools::ConvertToWindowsSlashes(wpath);
std::string wfullpath = cmSystemTools::EscapeSpaces(fullpath);
cmSystemTools::ConvertToWindowsSlashes(wfullpath);
std::string currentDir =
this->ConvertToOutputPath(m_Makefile->GetCurrentOutputDirectory());
std::string wpath = this->ConvertToOutputPath(path);
std::string wfullpath = this->ConvertToOutputPath(fullpath);
fout << wfullpath
<< ":\n\tcd " << wpath << "\n"
<< "\t$(MAKE) -$(MAKEFLAGS) $(MAKESILENT) cmake.depends\n"
<< "\t$(MAKE) -$(MAKEFLAGS) $(MAKESILENT) cmake.check_depends\n"
<< "\t$(MAKE) -$(MAKEFLAGS) $(MAKESILENT) -f cmake.check_depends\n"
<< "\t$(MAKE) $(MAKESILENT) " << wfullpath
<< "\n\tcd " <<
cmSystemTools::EscapeSpaces(currentDir.c_str()) << "\n";
<< "\n\tcd " << currentDir << "\n";
}
std::string cmNMakeMakefileGenerator::ConvertToNativePath(const char* s)
std::string cmNMakeMakefileGenerator::ConvertToOutputPath(const char* s)
{
std::string ret = s;
cmSystemTools::ConvertToWindowsSlashes(ret);
return ret;
return cmSystemTools::ConvertToOutputPath(s);
}