[Cmake-commits] [cmake-commits] king committed cmAddCustomCommandCommand.cxx 1.37 1.38 cmAddCustomCommandCommand.h 1.33 1.34 cmCustomCommand.cxx 1.24 1.25 cmCustomCommand.h 1.23 1.24 cmMakefileTargetGenerator.cxx 1.99 1.100

cmake-commits at cmake.org cmake-commits at cmake.org
Wed May 14 11:38:49 EDT 2008


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv28474/Source

Modified Files:
	cmAddCustomCommandCommand.cxx cmAddCustomCommandCommand.h 
	cmCustomCommand.cxx cmCustomCommand.h 
	cmMakefileTargetGenerator.cxx 
Log Message:
ENH: Add SKIP_RULE_DEPENDS option for add_custom_command()

  - Allows make rules to be created with no dependencies.
  - Such rules will not re-run even if the commands themselves change.
  - Useful to create rules that run only if the output is missing.


Index: cmAddCustomCommandCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmAddCustomCommandCommand.cxx,v
retrieving revision 1.37
retrieving revision 1.38
diff -C 2 -d -r1.37 -r1.38
*** cmAddCustomCommandCommand.cxx	30 Jan 2008 16:22:10 -0000	1.37
--- cmAddCustomCommandCommand.cxx	14 May 2008 15:38:46 -0000	1.38
***************
*** 41,44 ****
--- 41,45 ----
    bool verbatim = false;
    bool append = false;
+   bool skip_rule_depends = false;
    std::string implicit_depends_lang;
    cmCustomCommand::ImplicitDependsList implicit_depends;
***************
*** 104,107 ****
--- 105,113 ----
        verbatim = true;
        }
+     else if(copy == "SKIP_RULE_DEPENDS")
+       {
+       doing = doing_nothing;
+       skip_rule_depends = true;
+       }
      else if(copy == "APPEND")
        {
***************
*** 311,316 ****
                                               escapeOldStyle);
  
!     // Add implicit dependency scanning requests if any were given.
!     if(!implicit_depends.empty())
        {
        bool okay = false;
--- 317,322 ----
                                               escapeOldStyle);
  
!     // Get the rule object to add some extra information.
!     if(!implicit_depends.empty() || skip_rule_depends)
        {
        bool okay = false;
***************
*** 321,325 ****
            {
            okay = true;
!           cc->SetImplicitDepends(implicit_depends);
            }
          }
--- 327,340 ----
            {
            okay = true;
! 
!           // Add implicit dependency scanning requests if any were
!           // given.
!           if(!implicit_depends.empty())
!             {
!             cc->SetImplicitDepends(implicit_depends);
!             }
! 
!           // Set the rule dependency state.
!           cc->SetSkipRuleDepends(skip_rule_depends);
            }
          }

Index: cmAddCustomCommandCommand.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmAddCustomCommandCommand.h,v
retrieving revision 1.33
retrieving revision 1.34
diff -C 2 -d -r1.33 -r1.34
*** cmAddCustomCommandCommand.h	30 Jan 2008 16:22:10 -0000	1.33
--- cmAddCustomCommandCommand.h	14 May 2008 15:38:46 -0000	1.34
***************
*** 72,76 ****
        "                     [COMMAND command2 [ARGS] [args2...] ...]\n"
        "                     [MAIN_DEPENDENCY depend]\n"
!       "                     [DEPENDS [depends...]]\n"
        "                     [IMPLICIT_DEPENDS <lang1> depend1 ...]\n"
        "                     [WORKING_DIRECTORY dir]\n"
--- 72,76 ----
        "                     [COMMAND command2 [ARGS] [args2...] ...]\n"
        "                     [MAIN_DEPENDENCY depend]\n"
!       "                     [DEPENDS [depends...]] [SKIP_RULE_DEPENDS]\n"
        "                     [IMPLICIT_DEPENDS <lang1> depend1 ...]\n"
        "                     [WORKING_DIRECTORY dir]\n"
***************
*** 135,138 ****
--- 135,144 ----
        "SET_SOURCE_FILES_PROPERTIES.\n"
  
+       "The SKIP_RULE_DEPENDS option prevents the custom build rule from "
+       "having a dependency on itself.  This prevents the rule from running "
+       "again just because the command changed but is useful to create "
+       "rules that have absolutely no dependencies.  Such rules run only "
+       "when the output file is missing.\n"
+ 
        "The IMPLICIT_DEPENDS option requests scanning of implicit "
        "dependencies of an input file.  The language given specifies the "

Index: cmCustomCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmCustomCommand.cxx,v
retrieving revision 1.24
retrieving revision 1.25
diff -C 2 -d -r1.24 -r1.25
*** cmCustomCommand.cxx	17 Sep 2007 14:50:46 -0000	1.24
--- cmCustomCommand.cxx	14 May 2008 15:38:46 -0000	1.25
***************
*** 23,26 ****
--- 23,27 ----
    this->EscapeOldStyle = true;
    this->EscapeAllowMakeVars = false;
+   this->SkipRuleDepends = false;
  }
  
***************
*** 51,58 ****
    WorkingDirectory(workingDirectory?workingDirectory:""),
    EscapeAllowMakeVars(false),
!   EscapeOldStyle(true)
  {
-   this->EscapeOldStyle = true;
-   this->EscapeAllowMakeVars = false;
  }
  
--- 52,58 ----
    WorkingDirectory(workingDirectory?workingDirectory:""),
    EscapeAllowMakeVars(false),
!   EscapeOldStyle(true),
!   SkipRuleDepends(false)
  {
  }
  
***************
*** 137,140 ****
--- 137,152 ----
  
  //----------------------------------------------------------------------------
+ bool cmCustomCommand::GetSkipRuleDepends() const
+ {
+   return this->SkipRuleDepends;
+ }
+ 
+ //----------------------------------------------------------------------------
+ void cmCustomCommand::SetSkipRuleDepends(bool b)
+ {
+   this->SkipRuleDepends = b;
+ }
+ 
+ //----------------------------------------------------------------------------
  cmCustomCommand::ImplicitDependsList const&
  cmCustomCommand::GetImplicitDepends() const

Index: cmMakefileTargetGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefileTargetGenerator.cxx,v
retrieving revision 1.99
retrieving revision 1.100
diff -C 2 -d -r1.99 -r1.100
*** cmMakefileTargetGenerator.cxx	10 May 2008 22:39:06 -0000	1.99
--- cmMakefileTargetGenerator.cxx	14 May 2008 15:38:46 -0000	1.100
***************
*** 1123,1128 ****
  
    // Add a dependency on the rule file itself.
!   this->LocalGenerator->AppendRuleDepend(depends,
!                                          this->BuildFileNameFull.c_str());
  
    // Check whether we need to bother checking for a symbolic output.
--- 1123,1131 ----
  
    // Add a dependency on the rule file itself.
!   if(!cc.GetSkipRuleDepends())
!     {
!     this->LocalGenerator->AppendRuleDepend(depends,
!                                            this->BuildFileNameFull.c_str());
!     }
  
    // Check whether we need to bother checking for a symbolic output.

Index: cmCustomCommand.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmCustomCommand.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -C 2 -d -r1.23 -r1.24
*** cmCustomCommand.h	17 Sep 2007 14:50:46 -0000	1.23
--- cmCustomCommand.h	14 May 2008 15:38:46 -0000	1.24
***************
*** 69,72 ****
--- 69,76 ----
    void SetEscapeAllowMakeVars(bool b);
  
+   /** Set/Get whether to skip the dependency on the rule itself.  */
+   bool GetSkipRuleDepends() const;
+   void SetSkipRuleDepends(bool b);
+ 
    typedef std::pair<cmStdString, cmStdString> ImplicitDependsPair;
    class ImplicitDependsList: public std::vector<ImplicitDependsPair> {};
***************
*** 84,87 ****
--- 88,92 ----
    bool EscapeAllowMakeVars;
    bool EscapeOldStyle;
+   bool SkipRuleDepends;
    ImplicitDependsList ImplicitDepends;
  };



More information about the Cmake-commits mailing list