diff options
author | Brad King <brad.king@kitware.com> | 2001-04-09 14:31:36 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2001-04-09 14:31:36 (GMT) |
commit | e0da3ef275682626ec2e23d1abd6cca752882b47 (patch) | |
tree | 9a0e8ed9cc7a7fc8c3c07d89f255e08c33d257bb | |
parent | e7bd5fcd19064480142aae2928189dc822fad47c (diff) | |
download | CMake-e0da3ef275682626ec2e23d1abd6cca752882b47.zip CMake-e0da3ef275682626ec2e23d1abd6cca752882b47.tar.gz CMake-e0da3ef275682626ec2e23d1abd6cca752882b47.tar.bz2 |
ERR: Corrected use of double-quotes to be compatible with UNIX make. Now double quotes (windows) or escape sequences for spaces (unix) are added when dependencies are output.
-rw-r--r-- | Source/cmCableCommand.cxx | 12 | ||||
-rw-r--r-- | Source/cmDSPMakefile.cxx | 2 | ||||
-rw-r--r-- | Source/cmDSPWriter.cxx | 2 | ||||
-rw-r--r-- | Source/cmSystemTools.cxx | 16 | ||||
-rw-r--r-- | Source/cmSystemTools.h | 6 | ||||
-rw-r--r-- | Source/cmUnixMakefileGenerator.cxx | 3 | ||||
-rw-r--r-- | Source/cmUtilitySourceCommand.cxx | 4 |
7 files changed, 34 insertions, 11 deletions
diff --git a/Source/cmCableCommand.cxx b/Source/cmCableCommand.cxx index 03e0656..396a0fe 100644 --- a/Source/cmCableCommand.cxx +++ b/Source/cmCableCommand.cxx @@ -81,23 +81,23 @@ void cmCableCommand::SetupCableData() // We must add a custom rule to cause the cable_config.xml to be re-built // when it is removed. Rebuilding it means re-running CMake. - std::string cMakeLists = "\""; - cMakeLists += m_Makefile->GetStartDirectory(); + std::string cMakeLists = m_Makefile->GetStartDirectory(); cMakeLists += "/"; - cMakeLists += "CMakeLists.txt\""; + cMakeLists += "CMakeLists.txt"; std::string command; #if defined(_WIN32) && !defined(__CYGWIN__) command = "\""; command += m_Makefile->GetHomeDirectory(); - command += "/CMake/Source/CMakeSetupCMD\" "; + command += "/CMake/Source/CMakeSetupCMD\" \""; command += cMakeLists; - command += " -DSP"; + command += "\" -DSP"; #else command = "\""; command += m_Makefile->GetHomeOutputDirectory(); - command += "/CMake/Source/CMakeBuildTargets\" "; + command += "/CMake/Source/CMakeBuildTargets\" \""; command += cMakeLists; + command += "\""; #endif command += " -H\""; command += m_Makefile->GetHomeDirectory(); diff --git a/Source/cmDSPMakefile.cxx b/Source/cmDSPMakefile.cxx index 7a5f60a..766908b 100644 --- a/Source/cmDSPMakefile.cxx +++ b/Source/cmDSPMakefile.cxx @@ -322,7 +322,7 @@ void cmDSPMakefile::WriteCustomRule(std::ostream& fout, for(std::set<std::string>::const_iterator d = depends.begin(); d != depends.end(); ++d) { - fout << " " << d->c_str(); + fout << " \"" << d->c_str() << "\""; } fout << "\n " << command << "\n\n"; } diff --git a/Source/cmDSPWriter.cxx b/Source/cmDSPWriter.cxx index 7a5f60a..766908b 100644 --- a/Source/cmDSPWriter.cxx +++ b/Source/cmDSPWriter.cxx @@ -322,7 +322,7 @@ void cmDSPMakefile::WriteCustomRule(std::ostream& fout, for(std::set<std::string>::const_iterator d = depends.begin(); d != depends.end(); ++d) { - fout << " " << d->c_str(); + fout << " \"" << d->c_str() << "\""; } fout << "\n " << command << "\n\n"; } diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index a606bb4..957ee46 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -129,6 +129,22 @@ void cmSystemTools::ReplaceString(std::string& source, } } + +std::string cmSystemTools::EscapeSpaces(const char* str) +{ + std::string result = ""; + for(const char* ch = str; *ch != '\0'; ++ch) + { + if(*ch == ' ') + { + result += '\\'; + } + result += *ch; + } + return result; +} + + // return true if the file exists bool cmSystemTools::FileExists(const char* filename) { diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index f872a2c..04347fc 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -43,6 +43,12 @@ public: const char* with); /** + * Return a string equivalent to the input string, but with all " " replaced + * with "\ " to escape the spaces. + */ + static std::string EscapeSpaces(const char*); + + /** * Replace Windows file system slashes with Unix-style slashes. */ static void ConvertToUnixSlashes(std::string& path); diff --git a/Source/cmUnixMakefileGenerator.cxx b/Source/cmUnixMakefileGenerator.cxx index 0128848..068d85f 100644 --- a/Source/cmUnixMakefileGenerator.cxx +++ b/Source/cmUnixMakefileGenerator.cxx @@ -436,7 +436,8 @@ void cmUnixMakefileGenerator::OutputCustomRules(std::ostream& fout) commandFiles.m_Depends.begin(); d != commandFiles.m_Depends.end(); ++d) { - fout << " " << d->c_str(); + std::string dep = cmSystemTools::EscapeSpaces(d->c_str()); + fout << " " << dep.c_str(); } fout << "\n\t" << command.c_str() << "\n\n"; } diff --git a/Source/cmUtilitySourceCommand.cxx b/Source/cmUtilitySourceCommand.cxx index e098d5d..0cb83dd 100644 --- a/Source/cmUtilitySourceCommand.cxx +++ b/Source/cmUtilitySourceCommand.cxx @@ -70,8 +70,8 @@ bool cmUtilitySourceCommand::Invoke(std::vector<std::string>& args) // Construct the cache entry for the executable's location. std::string utilityExecutable = - "\""+utilityDirectory+"/"+cmakeCFGout+"/" - +utilityName+cmSystemTools::GetExecutableExtension()+"\""; + utilityDirectory+"/"+cmakeCFGout+"/" + +utilityName+cmSystemTools::GetExecutableExtension(); // Enter the value into the cache. cmCacheManager::GetInstance()->AddCacheEntry(cacheEntry.c_str(), |