From 7adaefb40346c133fadcf2c1c37780e5e051bb61 Mon Sep 17 00:00:00 2001 From: John Biddiscombe Date: Tue, 11 Sep 2001 21:45:35 -0400 Subject: ERR: Change to EscapeSpaces forces rework of Borland generator Add clause to prevent adding quotes when they're already present, then stuff them onto all lib paths to prevent forward slashes causing trouble. --- Source/cmBorlandMakefileGenerator.cpp | 29 +++++++++++++++++++---------- Source/cmBorlandMakefileGenerator.h | 2 ++ Source/cmSystemTools.cxx | 12 ++++++++++-- 3 files changed, 31 insertions(+), 12 deletions(-) diff --git a/Source/cmBorlandMakefileGenerator.cpp b/Source/cmBorlandMakefileGenerator.cpp index a37022c..0511926 100644 --- a/Source/cmBorlandMakefileGenerator.cpp +++ b/Source/cmBorlandMakefileGenerator.cpp @@ -98,13 +98,22 @@ void cmBorlandMakefileGenerator::RecursiveGenerateCacheOnly() mf->GenerateMakefile(); } // CLEAN up the makefiles created - for (unsigned int i=0; ic_str()) << "; \\\n "; + fout << "-I" << cmBorlandMakefileGenerator::EscapeSpaces(i->c_str()) << "; \\\n "; } fout << "-I" << - cmSystemTools::EscapeSpaces(m_Makefile->GetStartDirectory()) << "\n\n"; + cmBorlandMakefileGenerator::EscapeSpaces(m_Makefile->GetStartDirectory()) << "\n\n"; // // for each target add to the list of targets // @@ -282,7 +291,7 @@ void cmBorlandMakefileGenerator::OutputMakefile(const char* file) fout << "LINK_DIR ="; for (std::vector::const_iterator d=linkdirs.begin(); d!=linkdirs.end(); d++) { - std::string temp = cmSystemTools::EscapeSpaces(d->c_str()); + std::string temp = cmBorlandMakefileGenerator::EscapeSpaces(d->c_str()); fout << temp << ";"; } fout << "\n\n"; @@ -332,7 +341,7 @@ void cmBorlandMakefileGenerator::OutputMakefile(const char* file) { libname = "$(OUTDIRLIB)\\" + libname; } - fout << " \\\n " << cmSystemTools::EscapeSpaces(libname.c_str()); + fout << " \\\n " << cmBorlandMakefileGenerator::EscapeSpaces(libname.c_str()); } } fout << "\n\n"; @@ -372,7 +381,7 @@ void cmBorlandMakefileGenerator::OutputMakefile(const char* file) { libname = "$(OUTDIRLIB)\\" + libname + ".bpi"; } - fout << " \\\n " << cmSystemTools::EscapeSpaces(libname.c_str()); + fout << " \\\n " << cmBorlandMakefileGenerator::EscapeSpaces(libname.c_str()); } } fout << "\n\n"; @@ -650,7 +659,7 @@ void cmBorlandMakefileGenerator::OutputCustomRules(std::ostream& fout) commandFiles.m_Depends.begin(); d != commandFiles.m_Depends.end(); ++d) { - std::string dep = cmSystemTools::EscapeSpaces(d->c_str()); + std::string dep = cmBorlandMakefileGenerator::EscapeSpaces(d->c_str()); fout << " " << dep.c_str(); } fout << "\n\t" << command.c_str() << "\n\n"; @@ -660,14 +669,14 @@ void cmBorlandMakefileGenerator::OutputCustomRules(std::ostream& fout) commandFiles.m_Outputs.begin(); output != commandFiles.m_Outputs.end(); ++output) { - std::string src = cmSystemTools::EscapeSpaces(source.c_str()); + std::string src = cmBorlandMakefileGenerator::EscapeSpaces(source.c_str()); fout << output->c_str() << ": " << src.c_str(); // Write out all the dependencies for this rule. for(std::set::const_iterator d = commandFiles.m_Depends.begin(); d != commandFiles.m_Depends.end(); ++d) { - std::string dep = cmSystemTools::EscapeSpaces(d->c_str()); + std::string dep = cmBorlandMakefileGenerator::EscapeSpaces(d->c_str()); fout << " " << dep.c_str(); } fout << "\n\t" << command.c_str() << "\n\n"; diff --git a/Source/cmBorlandMakefileGenerator.h b/Source/cmBorlandMakefileGenerator.h index a0fa56d..f369101 100644 --- a/Source/cmBorlandMakefileGenerator.h +++ b/Source/cmBorlandMakefileGenerator.h @@ -80,6 +80,8 @@ private: const char* target, const char* depends, const char* command); + + std::string EscapeSpaces(const char* str); private: bool m_CacheOnly; bool m_Recurse; diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 795208d..fb2f297 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -345,9 +345,17 @@ std::string cmSystemTools::EscapeSpaces(const char* str) std::string temp = str; if (temp.find(" ") != std::string::npos) { - result = "\""; + // don't add quotes if they're already there + if (temp.find("\"")==std::string::npos) + { + result = "\""; + } result += cmSystemTools::HandleNetworkPaths(str); - return result+"\""; + if (temp.find("\"")==std::string::npos) + { + result += "\""; + } + return result; } return cmSystemTools::HandleNetworkPaths(str); -- cgit v0.12