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  d905333fad73754b594872e67e0e979f31a1b0ab (commit)
       via  fbf7a9297571b7e26739009d7026fbe21c3ccbc7 (commit)
      from  561267f15216de102807a42e043b9aebe1ea5388 (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=d905333fad73754b594872e67e0e979f31a1b0ab
commit d905333fad73754b594872e67e0e979f31a1b0ab
Merge: 561267f fbf7a92
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Tue Aug 12 13:58:11 2014 -0400
Commit:     CMake Topic Stage <kwro...@kitware.com>
CommitDate: Tue Aug 12 13:58:11 2014 -0400

    Merge topic 'makefile-assign-escape-octothorpe' into next
    
    fbf7a929 Makefile: Handle '#' in COMPILE_OPTIONS (#15070)


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fbf7a9297571b7e26739009d7026fbe21c3ccbc7
commit fbf7a9297571b7e26739009d7026fbe21c3ccbc7
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Tue Aug 12 13:26:03 2014 -0400
Commit:     Brad King <brad.k...@kitware.com>
CommitDate: Tue Aug 12 13:56:21 2014 -0400

    Makefile: Handle '#' in COMPILE_OPTIONS (#15070)
    
    Teach the Makefile generators to escape '#' characters on the right hand
    side of variable assignments in flags.make.  This is needed for flags
    like '-Wno-error=#warnings'.  Otherwise the make tool treats them as
    comments and leaves them out of the _FLAGS variable value.
    
    Add a case to the CompileOptions test covering '#' in a COMPILE_OPTIONS
    value, at least on compilers where it is known to be supported.

diff --git a/Source/cmMakefileTargetGenerator.cxx 
b/Source/cmMakefileTargetGenerator.cxx
index 758c8e4..7849d12 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -361,9 +361,13 @@ void cmMakefileTargetGenerator::WriteTargetLanguageFlags()
   for(std::set<std::string>::const_iterator l = languages.begin();
       l != languages.end(); ++l)
     {
-    *this->FlagFileStream << *l << "_FLAGS = " << this->GetFlags(*l) << "\n\n";
-    *this->FlagFileStream << *l << "_DEFINES = " << this->GetDefines(*l) <<
-      "\n\n";
+    std::string flags = this->GetFlags(*l);
+    std::string defines = this->GetDefines(*l);
+    // Escape comment characters so they do not terminate assignment.
+    cmSystemTools::ReplaceString(flags, "#", "\\#");
+    cmSystemTools::ReplaceString(defines, "#", "\\#");
+    *this->FlagFileStream << *l << "_FLAGS = " << flags << "\n\n";
+    *this->FlagFileStream << *l << "_DEFINES = " << defines << "\n\n";
     }
 }
 
diff --git a/Tests/CompileOptions/CMakeLists.txt 
b/Tests/CompileOptions/CMakeLists.txt
index 9b6c9c2..05a5f82 100644
--- a/Tests/CompileOptions/CMakeLists.txt
+++ b/Tests/CompileOptions/CMakeLists.txt
@@ -22,6 +22,12 @@ set_property(TARGET CompileOptions PROPERTY COMPILE_OPTIONS
   ${cxx_tests}
   )
 
+if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|Borland")
+  set_property(TARGET CompileOptions APPEND PROPERTY COMPILE_OPTIONS
+    "-DTEST_OCTOTHORPE=\"#\""
+    )
+endif()
+
 target_link_libraries(CompileOptions testlib)
 
 if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
diff --git a/Tests/CompileOptions/main.cpp b/Tests/CompileOptions/main.cpp
index 42f4cca..f3c1355 100644
--- a/Tests/CompileOptions/main.cpp
+++ b/Tests/CompileOptions/main.cpp
@@ -17,6 +17,9 @@
 int main()
 {
   return (strcmp(NEEDS_ESCAPE, "E$CAPE") == 0
+#ifdef TEST_OCTOTHORPE
+      && strcmp(TEST_OCTOTHORPE, "#") == 0
+#endif
       && strcmp(EXPECTED_C_COMPILER_VERSION, TEST_C_COMPILER_VERSION) == 0
       && strcmp(EXPECTED_CXX_COMPILER_VERSION, TEST_CXX_COMPILER_VERSION) == 0
       && TEST_C_COMPILER_VERSION_EQUALITY == 1

-----------------------------------------------------------------------

Summary of changes:
 Source/cmMakefileTargetGenerator.cxx |   10 +++++++---
 Tests/CompileOptions/CMakeLists.txt  |    6 ++++++
 Tests/CompileOptions/main.cpp        |    3 +++
 3 files changed, 16 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
CMake
_______________________________________________
Cmake-commits mailing list
Cmake-commits@cmake.org
http://public.kitware.com/mailman/listinfo/cmake-commits

Reply via email to