diff options
-rw-r--r-- | Source/cmCableWrapTclCommand.cxx | 41 | ||||
-rw-r--r-- | Source/cmDSPWriter.cxx | 1 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 16 | ||||
-rw-r--r-- | Source/cmMakefile.h | 4 | ||||
-rw-r--r-- | Source/cmSystemTools.cxx | 13 | ||||
-rw-r--r-- | Source/cmVTKWrapJavaCommand.cxx | 26 | ||||
-rw-r--r-- | Source/cmVTKWrapPythonCommand.cxx | 13 | ||||
-rw-r--r-- | Source/cmVTKWrapTclCommand.cxx | 17 |
8 files changed, 94 insertions, 37 deletions
diff --git a/Source/cmCableWrapTclCommand.cxx b/Source/cmCableWrapTclCommand.cxx index 510d781..74253bb 100644 --- a/Source/cmCableWrapTclCommand.cxx +++ b/Source/cmCableWrapTclCommand.cxx @@ -213,8 +213,11 @@ void cmCableWrapTclCommand::GenerateCableFiles() const m_Makefile->ExpandVariablesInString(command); std::vector<std::string> depends; depends.push_back(command); - std::string commandArgs = " "+packageConfigName+ - " -tcl "+packageTclFullName+".cxx"; + std::vector<std::string> commandArgs; + commandArgs.push_back(packageConfigName); + commandArgs.push_back("-tcl"); + std::string tmp = packageTclFullName+".cxx"; + commandArgs.push_back(tmp); depends.push_back(packageConfigName); @@ -223,7 +226,7 @@ void cmCableWrapTclCommand::GenerateCableFiles() const m_Makefile->AddCustomCommand(packageConfigName.c_str(), command.c_str(), - commandArgs.c_str(), + commandArgs, depends, outputs, m_TargetName.c_str()); @@ -341,30 +344,31 @@ void cmCableWrapTclCommand::GenerateCableClassFiles(const char* name, } } - std::string commandArgs = this->GetGccXmlFlagsFromCache(); - commandArgs += " "; - commandArgs += m_Makefile->GetDefineFlags(); - commandArgs += " -I\""; - commandArgs += m_Makefile->GetStartDirectory(); - commandArgs += "\""; + std::vector<std::string> commandArgs; + commandArgs.push_back(this->GetGccXmlFlagsFromCache()); + commandArgs.push_back(m_Makefile->GetDefineFlags()); + commandArgs.push_back("-I"); + commandArgs.push_back(m_Makefile->GetStartDirectory()); const std::vector<std::string>& includes = m_Makefile->GetIncludeDirectories(); for(std::vector<std::string>::const_iterator i = includes.begin(); i != includes.end(); ++i) { - commandArgs += " -I"; - commandArgs += cmSystemTools::EscapeSpaces(i->c_str()); + commandArgs.push_back("-I"); + commandArgs.push_back(cmSystemTools::EscapeSpaces(i->c_str())); } - - commandArgs += " -fxml="+classXmlName+" "+classCxxName; + std::string tmp = "-fxml="; + tmp += classXmlName; + commandArgs.push_back(tmp); + commandArgs.push_back(classCxxName); std::vector<std::string> outputs; outputs.push_back(classXmlName); m_Makefile->AddCustomCommand(classCxxName.c_str(), command.c_str(), - commandArgs.c_str(), + commandArgs, depends, outputs, m_TargetName.c_str()); } @@ -374,7 +378,11 @@ void cmCableWrapTclCommand::GenerateCableClassFiles(const char* name, std::string command = this->GetCableFromCache(); std::vector<std::string> depends; depends.push_back(command); - std::string commandArgs = " "+classConfigName+" -tcl "+classTclFullName+".cxx"; + std::vector<std::string > commandArgs; + commandArgs.push_back(classConfigName); + commandArgs.push_back("-tcl"); + std::string tmp = classTclFullName+".cxx"; + commandArgs.push_back(tmp); depends.push_back(classConfigName); depends.push_back(classXmlName); @@ -384,8 +392,7 @@ void cmCableWrapTclCommand::GenerateCableClassFiles(const char* name, m_Makefile->AddCustomCommand(classConfigName.c_str(), command.c_str(), - commandArgs.c_str(), - depends, + commandArgs, depends, outputs, m_TargetName.c_str()); } diff --git a/Source/cmDSPWriter.cxx b/Source/cmDSPWriter.cxx index 57c9e46..73da668 100644 --- a/Source/cmDSPWriter.cxx +++ b/Source/cmDSPWriter.cxx @@ -266,6 +266,7 @@ void cmDSPWriter::WriteDSPFile(std::ostream& fout, totalCommandStr += "\n\t"; temp= c->second.m_Command; cmSystemTools::ConvertToWindowsSlashes(temp); + temp = cmSystemTools::EscapeSpaces(temp.c_str()); totalCommandStr += temp; totalCommandStr += " "; totalCommandStr += c->second.m_Arguments; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 88aaaad..64d3e69 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -461,7 +461,7 @@ void cmMakefile::RemoveSource(cmSourceFile& cmfile,const char *srclist) void cmMakefile::AddCustomCommand(const char* source, const char* command, - const char* commandArgs, + const std::vector<std::string>& commandArgs, const std::vector<std::string>& depends, const std::vector<std::string>& outputs, const char *target) @@ -470,7 +470,17 @@ void cmMakefile::AddCustomCommand(const char* source, if (m_Targets.find(target) != m_Targets.end()) { std::string c = cmSystemTools::EscapeSpaces(command); - cmCustomCommand cc(source,c.c_str(),commandArgs,depends,outputs); + + std::string combinedArgs; + int i; + + for (i = 0; i < commandArgs.size(); ++i) + { + combinedArgs += cmSystemTools::EscapeSpaces(commandArgs[i].c_str()); + combinedArgs += " "; + } + + cmCustomCommand cc(source,c.c_str(),combinedArgs.c_str(),depends,outputs); m_Targets[target].GetCustomCommands().push_back(cc); std::string cacheCommand = command; this->ExpandVariablesInString(cacheCommand); @@ -484,7 +494,7 @@ void cmMakefile::AddCustomCommand(const char* source, void cmMakefile::AddCustomCommand(const char* source, const char* command, - const char* commandArgs, + const std::vector<std::string>& commandArgs, const std::vector<std::string>& depends, const char* output, const char *target) diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 3b41a71..83c0ab0 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -136,14 +136,14 @@ public: */ void AddCustomCommand(const char* source, const char* command, - const char* commandArgs, + const std::vector<std::string>& commandArgs, const std::vector<std::string>& depends, const std::vector<std::string>& outputs, const char *target); void AddCustomCommand(const char* source, const char* command, - const char* commandArgs, + const std::vector<std::string>& commandArgs, const std::vector<std::string>& depends, const char* output, const char* target); diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 22898ad..245b084 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -341,9 +341,16 @@ std::string cmSystemTools::EscapeSpaces(const char* str) #if defined(_WIN32) && !defined(__CYGWIN__) std::string result; - result = "\""; - result += cmSystemTools::HandleNetworkPaths(str); - return result+"\""; + // if there are spaces + std::string temp = str; + if (temp.find(" ") != std::string::npos) + { + result = "\""; + result += cmSystemTools::HandleNetworkPaths(str); + return result+"\""; + } + return cmSystemTools::HandleNetworkPaths(str); + #else std::string result = ""; for(const char* ch = str; *ch != '\0'; ++ch) diff --git a/Source/cmVTKWrapJavaCommand.cxx b/Source/cmVTKWrapJavaCommand.cxx index 58a5071..6ef2f30 100644 --- a/Source/cmVTKWrapJavaCommand.cxx +++ b/Source/cmVTKWrapJavaCommand.cxx @@ -112,9 +112,13 @@ void cmVTKWrapJavaCommand::FinalPass() std::string hints = "${VTK_WRAP_HINTS}"; std::string resultDirectory = "${VTK_JAVA_HOME}"; + m_Makefile->ExpandVariablesInString(hints); + // wrap all the .h files depends.push_back(wjava); + depends.push_back(hints); depends2.push_back(pjava); + depends2.push_back(hints); for(int classNum = 0; classNum < lastClass; classNum++) { m_Makefile->AddSource(m_WrapClasses[classNum],m_SourceList.c_str()); @@ -124,16 +128,26 @@ void cmVTKWrapJavaCommand::FinalPass() std::string res2 = resultDirectory + "/" + m_OriginalNames[classNum] + ".java"; - std::string cmd = " " + m_WrapHeaders[classNum] + " " - + hints + (m_WrapClasses[classNum].IsAnAbstractClass() ? " 0 " : " 1 ") + " > " + m_WrapClasses[classNum].GetSourceName() + ".cxx"; + std::vector<std::string> args; + args.push_back(m_WrapHeaders[classNum]); + args.push_back(hints); + args.push_back((m_WrapClasses[classNum].IsAnAbstractClass() ? "0" : "1")); + args.push_back(">"); + args.push_back(res); + m_Makefile->AddCustomCommand(m_WrapHeaders[classNum].c_str(), - wjava.c_str(), cmd.c_str(), depends, + wjava.c_str(), args, depends, res.c_str(), m_LibraryName.c_str()); - cmd = " " + m_WrapHeaders[classNum] + " " - + hints + (m_WrapClasses[classNum].IsAnAbstractClass() ? " 0 " : " 1 ") + " > " + res2; + std::vector<std::string> args2; + args2.push_back(m_WrapHeaders[classNum]); + args2.push_back(hints); + args2.push_back((m_WrapClasses[classNum].IsAnAbstractClass() ? "0" : "1")); + args2.push_back(">"); + args2.push_back(res2); + m_Makefile->AddCustomCommand(m_WrapHeaders[classNum].c_str(), - pjava.c_str(), cmd.c_str(), depends2, + pjava.c_str(), args2, depends2, res2.c_str(), m_LibraryName.c_str()); alldepends.push_back(res2); } diff --git a/Source/cmVTKWrapPythonCommand.cxx b/Source/cmVTKWrapPythonCommand.cxx index 3f8b7d4..3dfdb46 100644 --- a/Source/cmVTKWrapPythonCommand.cxx +++ b/Source/cmVTKWrapPythonCommand.cxx @@ -106,6 +106,8 @@ void cmVTKWrapPythonCommand::FinalPass() std::vector<std::string> depends; std::string wpython = "${VTK_WRAP_PYTHON_EXE}"; std::string hints = "${VTK_WRAP_HINTS}"; + + m_Makefile->ExpandVariablesInString(hints); // Create the init file std::string res = m_LibraryName; @@ -123,14 +125,19 @@ void cmVTKWrapPythonCommand::FinalPass() // wrap all the .h files depends.push_back(wpython); + depends.push_back(hints); for(int classNum = 0; classNum < lastClass; classNum++) { m_Makefile->AddSource(m_WrapClasses[classNum],m_SourceList.c_str()); std::string res = m_WrapClasses[classNum].GetSourceName() + ".cxx"; - std::string cmd = m_WrapHeaders[classNum] + " " - + hints + (m_WrapClasses[classNum].IsAnAbstractClass() ? " 0 " : " 1 ") + " > " + m_WrapClasses[classNum].GetSourceName() + ".cxx"; + std::vector<std::string> args; + args.push_back(m_WrapHeaders[classNum]); + args.push_back(hints); + args.push_back((m_WrapClasses[classNum].IsAnAbstractClass() ? "0" : "1")); + args.push_back(">"); + args.push_back(res); m_Makefile->AddCustomCommand(m_WrapHeaders[classNum].c_str(), - wpython.c_str(), cmd.c_str(), depends, + wpython.c_str(), args, depends, res.c_str(), m_LibraryName.c_str()); } diff --git a/Source/cmVTKWrapTclCommand.cxx b/Source/cmVTKWrapTclCommand.cxx index 2094e25..a81b049 100644 --- a/Source/cmVTKWrapTclCommand.cxx +++ b/Source/cmVTKWrapTclCommand.cxx @@ -139,6 +139,8 @@ void cmVTKWrapTclCommand::FinalPass() std::string wtcl = "${VTK_WRAP_TCL_EXE}"; std::string hints = "${VTK_WRAP_HINTS}"; + m_Makefile->ExpandVariablesInString(hints); + // Create the init file std::string res = m_LibraryName; res += "Init.cxx"; @@ -155,14 +157,23 @@ void cmVTKWrapTclCommand::FinalPass() // wrap all the .h files depends.push_back(wtcl); + depends.push_back(hints); for(int classNum = 0; classNum < lastClass; classNum++) { m_Makefile->AddSource(m_WrapClasses[classNum],m_SourceList.c_str()); std::string res = m_WrapClasses[classNum].GetSourceName() + ".cxx"; - std::string cmd = m_WrapHeaders[classNum] + " " - + hints + (m_WrapClasses[classNum].IsAnAbstractClass() ? " 0 " : " 1 ") + " > " + m_WrapClasses[classNum].GetSourceName() + ".cxx"; + std::vector<std::string> args; + args.push_back(m_WrapHeaders[classNum]); + args.push_back(hints); + args.push_back((m_WrapClasses[classNum].IsAnAbstractClass() ? "0" : "1")); + args.push_back(">"); + std::string tmp = m_Makefile->GetCurrentOutputDirectory(); + tmp += "/"; + tmp += m_WrapClasses[classNum].GetSourceName() + ".cxx"; + args.push_back(tmp); + m_Makefile->AddCustomCommand(m_WrapHeaders[classNum].c_str(), - wtcl.c_str(), cmd.c_str(), depends, + wtcl.c_str(), args, depends, res.c_str(), m_LibraryName.c_str()); } |