diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2001-11-30 04:24:37 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2001-11-30 04:24:37 (GMT) |
commit | c80c5d245d6a11182d308ebec62984bd3043d07c (patch) | |
tree | 85fcf2216f61588ad89530d67051d4fc267ec0d5 /Source | |
parent | f670003d24c8dacc5f1b6b9ee51ccf0db274a2c0 (diff) | |
download | CMake-c80c5d245d6a11182d308ebec62984bd3043d07c.zip CMake-c80c5d245d6a11182d308ebec62984bd3043d07c.tar.gz CMake-c80c5d245d6a11182d308ebec62984bd3043d07c.tar.bz2 |
ENH: fix various problems caused by the generalization of nmake generator
Diffstat (limited to 'Source')
-rw-r--r-- | Source/Makefile.borland | 3 | ||||
-rw-r--r-- | Source/cmBorlandMakefileGenerator2.cxx | 58 | ||||
-rw-r--r-- | Source/cmNMakeMakefileGenerator.cxx | 1 | ||||
-rw-r--r-- | Source/cmUnixMakefileGenerator.cxx | 13 |
4 files changed, 48 insertions, 27 deletions
diff --git a/Source/Makefile.borland b/Source/Makefile.borland index 4c8b8a0..64c0cc2 100644 --- a/Source/Makefile.borland +++ b/Source/Makefile.borland @@ -9,6 +9,9 @@ .cxx.obj: bcc32 -Pcxx -c -DCMAKE_ROOT_DIR='"."' {$< } +.cpp.obj: + bcc32 -Pcxx -c -DCMAKE_ROOT_DIR='"."' {$< } + OBJS = \ cmake.obj \ diff --git a/Source/cmBorlandMakefileGenerator2.cxx b/Source/cmBorlandMakefileGenerator2.cxx index befcb59..8461d57 100644 --- a/Source/cmBorlandMakefileGenerator2.cxx +++ b/Source/cmBorlandMakefileGenerator2.cxx @@ -83,12 +83,12 @@ void cmBorlandMakefileGenerator2::OutputMakeVariables(std::ostream& fout) const char* variables = "# general varibles 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_CXX_COMPILER = @CMAKE_CXX_COMPILER@\n" + "CMAKE_OBJECT_FILE_SUFFIX = @CMAKE_OBJECT_FILE_SUFFIX@\n" + "CMAKE_EXECUTABLE_SUFFIX = @CMAKE_EXECUTABLE_SUFFIX@\n" + "CMAKE_STATICLIB_SUFFIX = @CMAKE_STATICLIB_SUFFIX@\n" + "CMAKE_SHLIB_SUFFIX = @CMAKE_SHLIB_SUFFIX@\n" "CMAKE_CXXFLAGS = -P @CMAKE_CXX_FLAGS@ @BUILD_FLAGS@\n"; std::string buildType = "CMAKE_CXX_FLAGS_"; buildType += m_Makefile->GetDefinition("CMAKE_BUILD_TYPE"); @@ -98,6 +98,21 @@ void cmBorlandMakefileGenerator2::OutputMakeVariables(std::ostream& fout) buildType.c_str())); std::string replaceVars = variables; 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()) + << "\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 cmakecommand = m_Makefile->GetDefinition("CMAKE_COMMAND"); + cmSystemTools::ConvertToWindowsSlashes(cmakecommand); + fout << "CMAKE_COMMAND = " << cmSystemTools::EscapeSpaces(cmakecommand.c_str()) << "\n"; + fout << replaceVars.c_str(); fout << "CMAKE_CURRENT_SOURCE = " << ShortPath(m_Makefile->GetStartDirectory() ) @@ -302,18 +317,20 @@ void cmBorlandMakefileGenerator2::OutputSharedLibraryRule(std::ostream& fout, const char* name, const cmTarget &t) { - std::string target = m_LibraryOutputPath + name + ".dll"; + 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()); std::string depend = "$("; depend += name; depend += "_SRC_OBJS) $(" + std::string(name) + "_DEPEND_LIBS)"; std::string command = "$(CMAKE_CXX_COMPILER) -tWD @&&|\n"; - std::string dllpath = m_LibraryOutputPath + std::string(name); - std::string libpath = dllpath + ".lib"; - dllpath += ".dll"; - cmSystemTools::ConvertToWindowsSlashes(dllpath); // must be executable name command += "-e"; - command += cmSystemTools::EscapeSpaces(dllpath.c_str()); + command += target; command += " "; std::strstream linklibs; this->OutputLinkLibraries(linklibs, name, t); @@ -324,7 +341,7 @@ void cmBorlandMakefileGenerator2::OutputSharedLibraryRule(std::ostream& fout, // then list of object files command += " $(" + std::string(name) + "_SRC_OBJS) "; std::string command2 = "implib -w "; - command2 += libpath + " " + dllpath; + command2 += libpath + " " + target; const std::vector<cmSourceFile>& sources = t.GetSourceFiles(); for(std::vector<cmSourceFile>::const_iterator i = sources.begin(); i != sources.end(); ++i) @@ -357,16 +374,16 @@ void cmBorlandMakefileGenerator2::OutputStaticLibraryRule(std::ostream& fout, const cmTarget &) { std::string target = m_LibraryOutputPath + std::string(name) + ".lib"; + cmSystemTools::ConvertToWindowsSlashes(target); + target = cmSystemTools::EscapeSpaces(target.c_str()); std::string depend = "$("; depend += std::string(name) + "_SRC_OBJS)"; std::string command = "tlib @&&|\n\t /u "; - std::string libpath = m_LibraryOutputPath + std::string(name) + ".lib"; - cmSystemTools::ConvertToWindowsSlashes(libpath); - command += cmSystemTools::EscapeSpaces(libpath.c_str()); + command += target; std::string deleteCommand = "if exist "; - deleteCommand += libpath; + deleteCommand += target; deleteCommand += " del "; - deleteCommand += libpath; + deleteCommand += target; command += " $("; command += std::string(name) + "_SRC_OBJS)"; command += "\n|\n"; @@ -385,15 +402,14 @@ void cmBorlandMakefileGenerator2::OutputExecutableRule(std::ostream& fout, const char* name, const cmTarget &t) { - std::string target = m_ExecutableOutputPath + name; - target += ".exe"; + std::string target = m_ExecutableOutputPath + name + m_ExecutableExtension; + cmSystemTools::ConvertToWindowsSlashes(target); + target = cmSystemTools::EscapeSpaces(target.c_str()); std::string depend = "$("; depend += std::string(name) + "_SRC_OBJS) $(" + std::string(name) + "_DEPEND_LIBS)"; std::string command = "$(CMAKE_CXX_COMPILER) "; - std::string path = m_ExecutableOutputPath + name + ".exe"; - command += " -e" + - cmSystemTools::EscapeSpaces(path.c_str()); + command += " -e" + target; if(t.GetType() == cmTarget::WIN32_EXECUTABLE) { command += " -tWM "; diff --git a/Source/cmNMakeMakefileGenerator.cxx b/Source/cmNMakeMakefileGenerator.cxx index 3c208a7..b392b75 100644 --- a/Source/cmNMakeMakefileGenerator.cxx +++ b/Source/cmNMakeMakefileGenerator.cxx @@ -69,6 +69,7 @@ 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(ret.find(' ') == std::string::npos) { diff --git a/Source/cmUnixMakefileGenerator.cxx b/Source/cmUnixMakefileGenerator.cxx index e100b7c..33842ec 100644 --- a/Source/cmUnixMakefileGenerator.cxx +++ b/Source/cmUnixMakefileGenerator.cxx @@ -235,12 +235,13 @@ void cmUnixMakefileGenerator::OutputMakefile(const char* file) for(std::vector<std::string>::const_iterator i = lfiles.begin(); i != lfiles.end(); ++i) { - fout << " " << cmSystemTools::EscapeSpaces(i->c_str()); + fout << " " << this->ConvertToNativePath(cmSystemTools::EscapeSpaces(i->c_str()).c_str()); } // Add the cache to the list std::string cacheFile = m_Makefile->GetHomeOutputDirectory(); cacheFile += "/CMakeCache.txt"; - fout << " " << cmSystemTools::EscapeSpaces(cacheFile.c_str()); + fout << " " << + this->ConvertToNativePath(cmSystemTools::EscapeSpaces(cacheFile.c_str()).c_str()); fout << "\n\n\n"; this->OutputMakeVariables(fout); // Set up the default target as the VERY first target, so that make with no arguments will run it @@ -309,21 +310,21 @@ void cmUnixMakefileGenerator::OutputTargetRules(std::ostream& fout) { path = path + l->first + m_StaticLibraryExtension; fout << " \\\n" - << cmSystemTools::EscapeSpaces(path.c_str()); + << this->ConvertToNativePath(cmSystemTools::EscapeSpaces(path.c_str()).c_str()); } else if(l->second.GetType() == cmTarget::SHARED_LIBRARY) { path = path + l->first + m_Makefile->GetDefinition("CMAKE_SHLIB_SUFFIX"); fout << " \\\n" - << cmSystemTools::EscapeSpaces(path.c_str()); + << this->ConvertToNativePath(cmSystemTools::EscapeSpaces(path.c_str()).c_str()); } else if(l->second.GetType() == cmTarget::MODULE_LIBRARY) { path = path + l->first + m_Makefile->GetDefinition("CMAKE_MODULE_SUFFIX"); fout << " \\\n" - << cmSystemTools::EscapeSpaces(path.c_str()); + << this->ConvertToNativePath(cmSystemTools::EscapeSpaces(path.c_str()).c_str()); } } } @@ -337,7 +338,7 @@ void cmUnixMakefileGenerator::OutputTargetRules(std::ostream& fout) { std::string path = m_ExecutableOutputPath + l->first + m_ExecutableExtension; - fout << " \\\n" << cmSystemTools::EscapeSpaces(path.c_str()); + fout << " \\\n" << this->ConvertToNativePath(cmSystemTools::EscapeSpaces(path.c_str()).c_str()); } } // list utilities last |