[Cmake-commits] CMake branch, next, updated. v3.2.1-1718-g5b7b3b5

Brad King brad.king at kitware.com
Fri Apr 10 14:00:13 EDT 2015


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  5b7b3b57d97a831a27cc9f6dc2b5998a7780b6ca (commit)
       via  5472e7803520f98b396c7355b529e80f3a13df0c (commit)
       via  5c08e2559cf8ad5fc3cb220396016cf816a7b4b8 (commit)
      from  93adfcb8d412f7e1c15571bf51c4372ed23bd2ce (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=5b7b3b57d97a831a27cc9f6dc2b5998a7780b6ca
commit 5b7b3b57d97a831a27cc9f6dc2b5998a7780b6ca
Merge: 93adfcb 5472e78
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Apr 10 14:00:13 2015 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Apr 10 14:00:13 2015 -0400

    Merge topic 'custom-command-multiple-outputs' into next
    
    5472e780 Makefile: Fix multiple custom command outputs with one missing
    5c08e255 KWSys SystemTools: Teach Touch with !create to succeed on missing file


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5472e7803520f98b396c7355b529e80f3a13df0c
commit 5472e7803520f98b396c7355b529e80f3a13df0c
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Apr 10 13:03:34 2015 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri Apr 10 13:59:59 2015 -0400

    Makefile: Fix multiple custom command outputs with one missing
    
    The use of "cmake -E touch_nocreate" added in commit v3.2.1~4^2
    (Makefile: Fix multiple custom command outputs regression, 2015-03-06)
    caused builds to fail when one of the outputs is intentionally not
    created.  This was fixed by our parent commit by making touch_nocreate
    succeed when the file is missing.  Add a test case covering it.
    
    For the Watcom WMake generator, check for the SYMBOLIC source file
    property separately on each output.  The mark is needed on outputs that
    are not really created to tell 'wmake' not to complain that it is
    missing.  The mark is also needed on outputs that are created or 'wmake'
    will not consider them out of date when they exist.
    
    Inspired-by: Ben Boeckel <ben.boeckel at kitware.com>

diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 4ece016..12b931a 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -767,7 +767,7 @@ cmMakefileTargetGenerator
 
   // Write the rule.
   this->WriteMakeRule(*this->BuildFileStream, 0, outputs,
-                      depends, commands, false);
+                      depends, commands);
 
   bool do_preprocess_rules = lang_has_preprocessor &&
     this->LocalGenerator->GetCreatePreprocessedSourceRules();
@@ -989,18 +989,30 @@ void cmMakefileTargetGenerator::WriteTargetCleanRules()
 }
 
 //----------------------------------------------------------------------------
-void cmMakefileTargetGenerator::WriteMakeRule(
+bool cmMakefileTargetGenerator::WriteMakeRule(
   std::ostream& os,
   const char* comment,
   const std::vector<std::string>& outputs,
   const std::vector<std::string>& depends,
   const std::vector<std::string>& commands,
-  bool symbolic,
   bool in_help)
 {
+  bool symbolic = false;
   if (outputs.size() == 0)
     {
-    return;
+    return symbolic;
+    }
+
+  // Check whether we need to bother checking for a symbolic output.
+  bool need_symbolic = this->GlobalGenerator->GetNeedSymbolicMark();
+
+  // Check whether the first output is marked as symbolic.
+  if(need_symbolic)
+    {
+    if(cmSourceFile* sf = this->Makefile->GetSource(outputs[0]))
+      {
+      symbolic = sf->GetPropertyAsBool("SYMBOLIC");
+      }
     }
 
   // We always attach the actual commands to the first output.
@@ -1010,7 +1022,7 @@ void cmMakefileTargetGenerator::WriteMakeRule(
   // For single outputs, we are done.
   if (outputs.size() == 1)
     {
-    return;
+    return symbolic;
     }
 
   // For multiple outputs, make the extra ones depend on the first one.
@@ -1023,14 +1035,25 @@ void cmMakefileTargetGenerator::WriteMakeRule(
     std::string const out = this->Convert(*o, cmLocalGenerator::HOME_OUTPUT,
                                           cmLocalGenerator::SHELL);
     std::vector<std::string> output_commands;
-    if (!symbolic)
+
+    bool o_symbolic = false;
+    if(need_symbolic)
+      {
+      if(cmSourceFile* sf = this->Makefile->GetSource(*o))
+        {
+        o_symbolic = sf->GetPropertyAsBool("SYMBOLIC");
+        }
+      }
+    symbolic = symbolic && o_symbolic;
+
+    if (!o_symbolic)
       {
       output_commands.push_back("@$(CMAKE_COMMAND) -E touch_nocreate " + out);
       }
     this->LocalGenerator->WriteMakeRule(os, 0, *o, output_depends,
-                                        output_commands, symbolic, in_help);
+                                        output_commands, o_symbolic, in_help);
 
-    if (!symbolic)
+    if (!o_symbolic)
       {
       // At build time, remove the first output if this one does not exist
       // so that "make" will rerun the real commands that create this one.
@@ -1038,6 +1061,7 @@ void cmMakefileTargetGenerator::WriteMakeRule(
       this->MultipleOutputPairs.insert(p);
       }
     }
+  return symbolic;
 }
 
 //----------------------------------------------------------------------------
@@ -1289,23 +1313,12 @@ void cmMakefileTargetGenerator
   std::vector<std::string> depends;
   this->LocalGenerator->AppendCustomDepend(depends, ccg);
 
-  // Check whether we need to bother checking for a symbolic output.
-  bool need_symbolic = this->GlobalGenerator->GetNeedSymbolicMark();
-
   // Write the rule.
   const std::vector<std::string>& outputs = ccg.GetOutputs();
   std::vector<std::string>::const_iterator o = outputs.begin();
   {
-  bool symbolic = false;
-  if(need_symbolic)
-    {
-    if(cmSourceFile* sf = this->Makefile->GetSource(*o))
-      {
-      symbolic = sf->GetPropertyAsBool("SYMBOLIC");
-      }
-    }
-  this->WriteMakeRule(*this->BuildFileStream, 0, outputs,
-                      depends, commands, symbolic);
+  bool symbolic = this->WriteMakeRule(*this->BuildFileStream, 0,
+                                      outputs, depends, commands);
 
   // If the rule has changed make sure the output is rebuilt.
   if(!symbolic)
diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h
index f62c51d..42c4f58 100644
--- a/Source/cmMakefileTargetGenerator.h
+++ b/Source/cmMakefileTargetGenerator.h
@@ -224,12 +224,11 @@ protected:
 
   typedef std::map<std::string, std::string> MultipleOutputPairsType;
   MultipleOutputPairsType MultipleOutputPairs;
-  void WriteMakeRule(std::ostream& os,
+  bool WriteMakeRule(std::ostream& os,
                      const char* comment,
                      const std::vector<std::string>& outputs,
                      const std::vector<std::string>& depends,
                      const std::vector<std::string>& commands,
-                     bool symbolic,
                      bool in_help = false);
 
   // Target name info.
diff --git a/Tests/BuildDepends/CMakeLists.txt b/Tests/BuildDepends/CMakeLists.txt
index 78e9e17..0b1ff2c 100644
--- a/Tests/BuildDepends/CMakeLists.txt
+++ b/Tests/BuildDepends/CMakeLists.txt
@@ -66,6 +66,7 @@ set(link_depends_no_shared_check_txt ${BuildDepends_BINARY_DIR}/Project/link_dep
 
 file(WRITE ${BuildDepends_BINARY_DIR}/Project/external.in "external original\n")
 file(WRITE ${BuildDepends_BINARY_DIR}/Project/multi1-in.txt "multi1-in original\n")
+file(WRITE ${BuildDepends_BINARY_DIR}/Project/multi2-stamp.txt "multi2-stamp original\n")
 
 help_xcode_depends()
 
@@ -191,6 +192,19 @@ else()
     "multi1-out2-copy.txt is missing")
 endif()
 
+if(EXISTS ${BuildDepends_BINARY_DIR}/Project/multi2-out1.txt)
+  if(${BuildDepends_BINARY_DIR}/Project/multi2-out1.txt
+      IS_NEWER_THAN ${BuildDepends_BINARY_DIR}/Project/multi2-stamp.txt)
+    message(STATUS "multi2-out1.txt is newer than multi2-stamp.txt")
+  else()
+    message(SEND_ERROR "Project did not initially build properly: "
+      "multi2-out1.txt is not newer than multi2-stamp.txt")
+  endif()
+else()
+  message(SEND_ERROR "Project did not initially build properly: "
+    "multi2-out1.txt is missing")
+endif()
+
 message("Waiting 3 seconds...")
 execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 3)
 
@@ -217,6 +231,7 @@ endif()
 
 file(WRITE ${BuildDepends_BINARY_DIR}/Project/external.in "external changed\n")
 file(WRITE ${BuildDepends_BINARY_DIR}/Project/multi1-in.txt "multi1-in changed\n")
+file(WRITE ${BuildDepends_BINARY_DIR}/Project/multi2-stamp.txt "multi2-stamp changed\n")
 
 help_xcode_depends()
 
@@ -347,3 +362,16 @@ else()
   message(SEND_ERROR "Project did not rebuild properly: "
     "multi1-out2-copy.txt is missing")
 endif()
+
+if(EXISTS ${BuildDepends_BINARY_DIR}/Project/multi2-out1.txt)
+  if(${BuildDepends_BINARY_DIR}/Project/multi2-out1.txt
+      IS_NEWER_THAN ${BuildDepends_BINARY_DIR}/Project/multi2-stamp.txt)
+    message(STATUS "multi2-out1.txt is newer than multi2-stamp.txt")
+  else()
+    message(SEND_ERROR "Project did not rebuild properly: "
+      "multi2-out1.txt is not newer than multi2-stamp.txt")
+  endif()
+else()
+  message(SEND_ERROR "Project did not rebuild properly: "
+    "multi2-out1.txt is missing")
+endif()
diff --git a/Tests/BuildDepends/Project/CMakeLists.txt b/Tests/BuildDepends/Project/CMakeLists.txt
index cb9fbf8..9b2b5aa 100644
--- a/Tests/BuildDepends/Project/CMakeLists.txt
+++ b/Tests/BuildDepends/Project/CMakeLists.txt
@@ -164,3 +164,10 @@ add_custom_command(
   DEPENDS multi1-out2.txt
   )
 add_custom_target(multi1 ALL DEPENDS multi1-out2-copy.txt)
+
+add_custom_command(
+  OUTPUT multi2-out1.txt multi2-out2.txt
+  COMMAND ${CMAKE_COMMAND} -E touch multi2-out1.txt
+  )
+set_property(SOURCE multi2-out1.txt multi2-out2.txt PROPERTY SYMBOLIC 1)
+add_custom_target(multi2 ALL DEPENDS multi2-out1.txt)

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5c08e2559cf8ad5fc3cb220396016cf816a7b4b8
commit 5c08e2559cf8ad5fc3cb220396016cf816a7b4b8
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Apr 10 11:07:50 2015 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri Apr 10 12:51:10 2015 -0400

    KWSys SystemTools: Teach Touch with !create to succeed on missing file

diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index b03e7b0..b9b65a0 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -1215,15 +1215,22 @@ bool SystemTools::PathCygwinToWin32(const char *path, char *win32_path)
 
 bool SystemTools::Touch(const kwsys_stl::string& filename, bool create)
 {
-  if(create && !SystemTools::FileExists(filename))
+  if (!SystemTools::FileExists(filename))
     {
-    FILE* file = Fopen(filename, "a+b");
-    if(file)
+    if(create)
+      {
+      FILE* file = Fopen(filename, "a+b");
+      if(file)
+        {
+        fclose(file);
+        return true;
+        }
+      return false;
+      }
+    else
       {
-      fclose(file);
       return true;
       }
-    return false;
     }
 #if defined(_WIN32) && !defined(__CYGWIN__)
   HANDLE h = CreateFileW(

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

Summary of changes:
 Source/cmMakefileTargetGenerator.cxx      |   55 ++++++++++++++++++-----------
 Source/cmMakefileTargetGenerator.h        |    3 +-
 Source/kwsys/SystemTools.cxx              |   17 ++++++---
 Tests/BuildDepends/CMakeLists.txt         |   28 +++++++++++++++
 Tests/BuildDepends/Project/CMakeLists.txt |    7 ++++
 5 files changed, 82 insertions(+), 28 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list