diff options
author | Sebastien Barre <sebastien.barre@kitware.com> | 2001-12-06 18:32:28 (GMT) |
---|---|---|
committer | Sebastien Barre <sebastien.barre@kitware.com> | 2001-12-06 18:32:28 (GMT) |
commit | dea1309e8d00547c685320606041dd047d2293b2 (patch) | |
tree | 74ffc1e7da0193d1a5020fbdc3a6c4c2008be6b5 /Source/cmNMakeMakefileGenerator.cxx | |
parent | 2b8e16e59c3bfe41482820d8d5d0a3ddbbbb3fbf (diff) | |
download | CMake-dea1309e8d00547c685320606041dd047d2293b2.zip CMake-dea1309e8d00547c685320606041dd047d2293b2.tar.gz CMake-dea1309e8d00547c685320606041dd047d2293b2.tar.bz2 |
Fix the command quoting pb (remove m_QuoteNextCommand), move ConvertToNativePath to NMake gen
Diffstat (limited to 'Source/cmNMakeMakefileGenerator.cxx')
-rw-r--r-- | Source/cmNMakeMakefileGenerator.cxx | 59 |
1 files changed, 35 insertions, 24 deletions
diff --git a/Source/cmNMakeMakefileGenerator.cxx b/Source/cmNMakeMakefileGenerator.cxx index d91149c..04be7aa 100644 --- a/Source/cmNMakeMakefileGenerator.cxx +++ b/Source/cmNMakeMakefileGenerator.cxx @@ -57,7 +57,6 @@ cmNMakeMakefileGenerator::cmNMakeMakefileGenerator() this->SetLibraryPrefix(""); this->SetStaticLibraryExtension("$(CMAKE_STATICLIB_SUFFIX)"); this->SetSharedLibraryExtension("$(CMAKE_SHLIB_SUFFIX)"); - m_QuoteNextCommand = true; // most of the time command should be quoted } cmNMakeMakefileGenerator::~cmNMakeMakefileGenerator() @@ -143,21 +142,15 @@ void cmNMakeMakefileGenerator::OutputMakeVariables(std::ostream& fout) { fout << "# NMake Makefile generated by cmake\n"; const char* variables = - "# general varibles used in the makefile\n" + "# general variables used in the makefile\n" "\n" "# Path to cmake\n" - "CMAKE_COMMAND = ${CMAKE_COMMAND}\n" "CMAKE_STANDARD_WINDOWS_LIBRARIES = @CMAKE_STANDARD_WINDOWS_LIBRARIES@\n" - "CMAKE_C_COMPILER = @CMAKE_C_COMPILER@\n" "CMAKE_C_FLAGS = @CMAKE_C_FLAGS@ @BUILD_FLAGS@\n" - "CMAKE_C_LINK_EXECUTABLE_FLAG = @CMAKE_C_LINK_EXECUTABLE_FLAG@\n" "CMAKE_CXX_FLAGS = @CMAKE_CXX_FLAGS@ @BUILD_FLAGS@\n" - "CMAKE_CXX_COMPILER = @CMAKE_CXX_COMPILER@\n" - "CMAKE_LINKER = @CMAKE_LINKER@\n" "CMAKE_LINKER_FLAGS = @CMAKE_LINKER_FLAGS@ @LINKER_BUILD_FLAGS@\n" "CMAKE_LINKER_SHARED_LIBRARY_FLAG = @CMAKE_LINKER_SHARED_LIBRARY_FLAG@\n" - "CMAKE_LIBRARY_MANAGER = @CMAKE_LIBRARY_MANAGER@\n" "CMAKE_LIBRARY_MANAGER_FLAGS = @CMAKE_LIBRARY_MANAGER_FLAGS@\n" "CMAKE_OBJECT_FILE_SUFFIX = @CMAKE_OBJECT_FILE_SUFFIX@\n" "CMAKE_EXECUTABLE_SUFFIX = @CMAKE_EXECUTABLE_SUFFIX@\n" @@ -181,6 +174,27 @@ void cmNMakeMakefileGenerator::OutputMakeVariables(std::ostream& fout) std::string replaceVars = variables; m_Makefile->ExpandVariablesInString(replaceVars); 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"; + + std::string cxxcompiler = m_Makefile->GetDefinition("CMAKE_CXX_COMPILER"); + cmSystemTools::ConvertToWindowsSlashes(cxxcompiler); + fout << "CMAKE_CXX_COMPILER = " << cmSystemTools::EscapeSpaces(cxxcompiler.c_str()) << "\n"; + + std::string linker = m_Makefile->GetDefinition("CMAKE_LINKER"); + cmSystemTools::ConvertToWindowsSlashes(linker); + fout << "CMAKE_LINKER = " << cmSystemTools::EscapeSpaces(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"; + + std::string cmakecommand = m_Makefile->GetDefinition("CMAKE_COMMAND"); + cmSystemTools::ConvertToWindowsSlashes(cmakecommand); + fout << "CMAKE_COMMAND = " << cmSystemTools::EscapeSpaces(cmakecommand.c_str()) << "\n"; + fout << "CMAKE_CURRENT_SOURCE = " << ShortPath(m_Makefile->GetStartDirectory() ) << "\n"; @@ -192,6 +206,7 @@ void cmNMakeMakefileGenerator::OutputMakeVariables(std::ostream& fout) fout << "CMAKE_BINARY_DIR = " << ShortPath(m_Makefile->GetHomeOutputDirectory() ) << "\n"; + // Output Include paths fout << "INCLUDE_FLAGS = "; std::vector<std::string>& includes = m_Makefile->GetIncludeDirectories(); @@ -208,6 +223,7 @@ void cmNMakeMakefileGenerator::OutputMakeVariables(std::ostream& fout) fout << "-I" << cmSystemTools::EscapeSpaces(i->c_str()).c_str() << " "; } } + fout << m_Makefile->GetDefineFlags(); fout << "\n\n"; } @@ -279,13 +295,8 @@ 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"; - } + const char* startCommand = "\t"; + const char* endCommand = "\n"; if(command) { replace = ShortPathCommand(command); @@ -311,11 +322,6 @@ void cmNMakeMakefileGenerator::OutputMakeRule(std::ostream& fout, 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 @@ -371,6 +377,7 @@ OutputBuildObjectFromSource(std::ostream& fout, // assume c++ if not c rc or def else { + compileCommand = "$(CMAKE_CXX_COMPILER) $(CMAKE_CXX_FLAGS) "; compileCommand += extraCompileFlags; if(shared) @@ -390,7 +397,6 @@ OutputBuildObjectFromSource(std::ostream& fout, compileCommand += " " + output_object_file_flag; compileCommand += objectFile; } - m_QuoteNextCommand = false; this->OutputMakeRule(fout, comment.c_str(), objectFile.c_str(), @@ -437,7 +443,6 @@ void cmNMakeMakefileGenerator::OutputSharedLibraryRule(std::ostream& fout, } } command += "\n<<\n"; - m_QuoteNextCommand = false; this->OutputMakeRule(fout, "rules for a shared library", target.c_str(), depend.c_str(), @@ -474,7 +479,6 @@ void cmNMakeMakefileGenerator::OutputStaticLibraryRule(std::ostream& fout, command += "\n<<\n"; std::string comment = "rule to build static library: "; comment += name; - m_QuoteNextCommand = false; this->OutputMakeRule(fout, comment.c_str(), target.c_str(), @@ -516,7 +520,6 @@ 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(), @@ -648,3 +651,11 @@ void cmNMakeMakefileGenerator::OutputBuildLibraryInDir(std::ostream& fout, << "\n\tcd " << cmSystemTools::EscapeSpaces(currentDir.c_str()) << "\n"; } + + +std::string cmNMakeMakefileGenerator::ConvertToNativePath(const char* s) +{ + std::string ret = s; + cmSystemTools::ConvertToWindowsSlashes(ret); + return ret; +} |