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 | |
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')
-rw-r--r-- | Source/cmNMakeMakefileGenerator.cxx | 25 | ||||
-rw-r--r-- | Source/cmNMakeMakefileGenerator.h | 5 | ||||
-rw-r--r-- | Source/cmUnixMakefileGenerator.h | 14 | ||||
-rw-r--r-- | Source/cmake.cxx | 2 |
4 files changed, 34 insertions, 12 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(), diff --git a/Source/cmNMakeMakefileGenerator.h b/Source/cmNMakeMakefileGenerator.h index 239524c..7249e87 100644 --- a/Source/cmNMakeMakefileGenerator.h +++ b/Source/cmNMakeMakefileGenerator.h @@ -98,6 +98,11 @@ protected: virtual void OutputLinkLibraries(std::ostream& fout, const char* targetLibrary, const cmTarget &tgt); +private: + bool m_QuoteNextCommand; // if this is true, OutputMakeRule + // will not quote the next commands + // it is reset to false after each + // call to OutputMakeRule }; #endif diff --git a/Source/cmUnixMakefileGenerator.h b/Source/cmUnixMakefileGenerator.h index 2b0bc29..b30d6b9 100644 --- a/Source/cmUnixMakefileGenerator.h +++ b/Source/cmUnixMakefileGenerator.h @@ -144,13 +144,13 @@ protected: const std::vector<std::string>& SubDirectories); virtual void OutputMakeRule(std::ostream&, - const char* comment, - const char* target, - const char* depends, - const char* command, - const char* command2 = 0, - const char* command3 = 0, - const char* command4 = 0); + const char* comment, + const char* target, + const char* depends, + const char* command, + const char* command2 = 0, + const char* command3 = 0, + const char* command4 = 0); void SetObjectFileExtension(const char* e) { m_ObjectFileExtension = e;} void SetExecutableExtension(const char* e) { m_ExecutableExtension = e;} void SetStaticLibraryExtension(const char* e) {m_StaticLibraryExtension = e;} diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 1716c04..30fde30 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -55,7 +55,7 @@ cmake::cmake() m_Verbose = false; #if defined(_WIN32) && !defined(__CYGWIN__) cmMakefileGenerator::RegisterGenerator(new cmMSProjectGenerator); -// cmMakefileGenerator::RegisterGenerator(new cmNMakeMakefileGenerator); + cmMakefileGenerator::RegisterGenerator(new cmNMakeMakefileGenerator); cmMakefileGenerator::RegisterGenerator(new cmBorlandMakefileGenerator); #else cmMakefileGenerator::RegisterGenerator(new cmUnixMakefileGenerator); |