[Cmake-commits] CMake branch, next, updated. v2.8.8-3041-g1ecbdf7
Brad King
brad.king at kitware.com
Wed Jun 6 08:49:33 EDT 2012
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via 1ecbdf74042c065512baca4377cf67e522a81ad3 (commit)
via ee6c1b8aca88b57dcded02980cf3a96f43e706b8 (commit)
from fd3718e407b64948bd790b095c200a41ee3b67e2 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1ecbdf74042c065512baca4377cf67e522a81ad3
commit 1ecbdf74042c065512baca4377cf67e522a81ad3
Merge: fd3718e ee6c1b8
Author: Brad King <brad.king at kitware.com>
AuthorDate: Wed Jun 6 08:49:20 2012 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Jun 6 08:49:20 2012 -0400
Merge topic 'makefile-escape-equals' into next
ee6c1b8 Makefile: Support directory names containing '=' (#12934)
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ee6c1b8aca88b57dcded02980cf3a96f43e706b8
commit ee6c1b8aca88b57dcded02980cf3a96f43e706b8
Author: Brad King <brad.king at kitware.com>
AuthorDate: Wed Jun 6 08:30:54 2012 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Wed Jun 6 08:30:54 2012 -0400
Makefile: Support directory names containing '=' (#12934)
Since commit c8ef6430 (Allow directory names containing '=' and warn if
necessary, 2012-02-06) we allow directories with '=' instead of
rejecting them as was previously done since commit 8704525f (Reject
directory names containing '=', 2011-01-14). However, we did not warn
in all cases that '=' may cause failure, such as when it appears on the
right-hand side of a dependency line.
Both commits above were made assuming that '=' cannot be escaped in Make
syntax, but it can be achieved with a variable:
EQUALS = =
left$(EQUALS)side : right$(EQUALS)side
Use this approach to escape '=' in dependency lines, thus supporting
the character in paths.
All our tests now pass when CMake is built in source and build trees
both containing '=', except for the "OutOfSource" test. It fails in
its coverage of the obscure "OutOfBinary" test case where part of the
build tree is located outside the main build tree of the test. The
reason is that CMake must invoke a command like
$(MAKE) -f /path/with=sign/build.make /path/with=sign/somefile
but the make tool interprets the last argument as a variable assignment.
This is an acceptable limitation, since the case is so obscure, in
exchange for supporting '=' cleanly otherwise.
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index a645303..db93529 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -36,6 +36,30 @@
#include <queue>
//----------------------------------------------------------------------------
+// Escape special characters in Makefile dependency lines
+class cmMakeSafe
+{
+public:
+ cmMakeSafe(const char* s): Data(s) {}
+ cmMakeSafe(std::string const& s): Data(s.c_str()) {}
+private:
+ const char* Data;
+ friend std::ostream& operator<<(std::ostream& os,
+ cmMakeSafe const& self)
+ {
+ for(const char* c = self.Data; *c; ++c)
+ {
+ switch (*c)
+ {
+ case '=': os << "$(EQUALS)"; break;
+ default: os << *c; break;
+ }
+ }
+ return os;
+ }
+};
+
+//----------------------------------------------------------------------------
// Helper function used below.
static std::string cmSplitExtension(std::string const& in, std::string& base)
{
@@ -555,28 +579,13 @@ cmLocalUnixMakefileGenerator3
space = " ";
}
- // Warn about paths not supported by Make tools.
- std::string::size_type pos = tgt.find_first_of("=");
- if(pos != std::string::npos)
- {
- cmOStringStream m;
- m <<
- "Make rule for\n"
- " " << tgt << "\n"
- "has '=' on left hand side. "
- "The make tool may not support this.";
- cmListFileBacktrace bt;
- this->GlobalGenerator->GetCMakeInstance()
- ->IssueMessage(cmake::WARNING, m.str(), bt);
- }
-
// Mark the rule as symbolic if requested.
if(symbolic)
{
if(const char* sym =
this->Makefile->GetDefinition("CMAKE_MAKE_SYMBOLIC_RULE"))
{
- os << tgt.c_str() << space << ": " << sym << "\n";
+ os << cmMakeSafe(tgt) << space << ": " << sym << "\n";
}
}
@@ -584,7 +593,7 @@ cmLocalUnixMakefileGenerator3
if(depends.empty())
{
// No dependencies. The commands will always run.
- os << tgt.c_str() << space << ":\n";
+ os << cmMakeSafe(tgt) << space << ":\n";
}
else
{
@@ -595,7 +604,7 @@ cmLocalUnixMakefileGenerator3
{
replace = *dep;
replace = this->Convert(replace.c_str(),HOME_OUTPUT,MAKEFILE);
- os << tgt.c_str() << space << ": " << replace.c_str() << "\n";
+ os << cmMakeSafe(tgt) << space << ": " << cmMakeSafe(replace) << "\n";
}
}
@@ -608,7 +617,7 @@ cmLocalUnixMakefileGenerator3
}
if(symbolic && !this->WatcomWMake)
{
- os << ".PHONY : " << tgt.c_str() << "\n";
+ os << ".PHONY : " << cmMakeSafe(tgt) << "\n";
}
os << "\n";
// Add the output to the local help if requested.
@@ -687,6 +696,10 @@ cmLocalUnixMakefileGenerator3
<< this->ConvertShellCommand(cmakecommand, FULL)
<< " -E remove -f\n"
<< "\n";
+ makefileStream
+ << "# Escaping for special characters.\n"
+ << "EQUALS = =\n"
+ << "\n";
if(const char* edit_cmd =
this->Makefile->GetDefinition("CMAKE_EDIT_COMMAND"))
-----------------------------------------------------------------------
Summary of changes:
Source/cmLocalUnixMakefileGenerator3.cxx | 51 ++++++++++++++++++-----------
1 files changed, 32 insertions(+), 19 deletions(-)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list