diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2001-11-15 14:55:50 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2001-11-15 14:55:50 (GMT) |
commit | 2df56cf21b6b7da1a4655f95333f2f059c24f859 (patch) | |
tree | f890cb0c275dcb6880c984277d4107a631d87c3f /Source/cmNMakeMakefileGenerator.cxx | |
parent | 4b34ffa669466584f44aa76d3756b5b22b285674 (diff) | |
download | CMake-2df56cf21b6b7da1a4655f95333f2f059c24f859.zip CMake-2df56cf21b6b7da1a4655f95333f2f059c24f859.tar.gz CMake-2df56cf21b6b7da1a4655f95333f2f059c24f859.tar.bz2 |
ENH: fix library builds with nmake
Diffstat (limited to 'Source/cmNMakeMakefileGenerator.cxx')
-rw-r--r-- | Source/cmNMakeMakefileGenerator.cxx | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/Source/cmNMakeMakefileGenerator.cxx b/Source/cmNMakeMakefileGenerator.cxx index 6280fb7..0964326 100644 --- a/Source/cmNMakeMakefileGenerator.cxx +++ b/Source/cmNMakeMakefileGenerator.cxx @@ -54,6 +54,7 @@ cmNMakeMakefileGenerator::cmNMakeMakefileGenerator() this->SetLibraryPrefix(""); this->SetSharedLibraryExtension(".dll"); this->SetStaticLibraryExtension(".lib"); + m_QuoteNextCommand = true; // most of the time command should be quoted } cmNMakeMakefileGenerator::~cmNMakeMakefileGenerator() @@ -186,31 +187,43 @@ void cmNMakeMakefileGenerator::OutputMakeRule(std::ostream& fout, fout << replace.c_str(); } fout << "\n"; + const char* startCommand = "\t\""; + const char* endCommand = "\"\n"; + if(!m_QuoteNextCommand) + { + startCommand = "\t"; + endCommand = "\n"; + } if(command) { replace = command; m_Makefile->ExpandVariablesInString(replace); - fout << "\t\"" << replace.c_str() << "\"\n"; + fout << startCommand << replace.c_str() << endCommand; } if(command2) { replace = command2; m_Makefile->ExpandVariablesInString(replace); - fout << "\t\"" << replace.c_str() << "\"\n"; + fout << startCommand << replace.c_str() << endCommand; } if(command3) { replace = command3; m_Makefile->ExpandVariablesInString(replace); - fout << "\t\"" << replace.c_str() << "\"\n"; + fout << startCommand << replace.c_str() << endCommand; } if(command4) { replace = command4; m_Makefile->ExpandVariablesInString(replace); - fout << "\t\"" << replace.c_str() << "\"\n"; + fout << startCommand << replace.c_str() << endCommand; } fout << "\n"; + // reset m_QuoteNextCommand, as the default should be to quote the + // commands. We need the quotes when the command has a full path + // to an executable. However, the quotes break things like the + // linker command. + m_QuoteNextCommand = true; } void @@ -262,6 +275,7 @@ OutputBuildObjectFromSource(std::ostream& fout, compileCommand += " /Fo"; compileCommand += objectFile; } + m_QuoteNextCommand = false; this->OutputMakeRule(fout, comment.c_str(), objectFile.c_str(), @@ -285,6 +299,7 @@ void cmNMakeMakefileGenerator::OutputSharedLibraryRule(std::ostream& fout, linklibs << std::ends; command += linklibs.str(); delete [] linklibs.str(); + m_QuoteNextCommand = false; this->OutputMakeRule(fout, "rules for a shared library", target.c_str(), depend.c_str(), @@ -312,6 +327,7 @@ void cmNMakeMakefileGenerator::OutputStaticLibraryRule(std::ostream& fout, command += std::string(name) + "_SRC_OBJS)"; std::string comment = "rule to build static library: "; comment += name; + m_QuoteNextCommand = false; this->OutputMakeRule(fout, comment.c_str(), target.c_str(), @@ -338,6 +354,7 @@ void cmNMakeMakefileGenerator::OutputExecutableRule(std::ostream& fout, command += linklibs.str(); std::string comment = "rule to build executable: "; comment += name; + m_QuoteNextCommand = false; this->OutputMakeRule(fout, comment.c_str(), target.c_str(), |