[cmake-commits] king committed cmAddCustomTargetCommand.cxx 1.24 1.25 cmAddCustomTargetCommand.h 1.19 1.20 cmMakefile.cxx 1.358 1.359 cmMakefile.h 1.194 1.195

cmake-commits at cmake.org cmake-commits at cmake.org
Wed Oct 4 18:10:31 EDT 2006


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

Modified Files:
	cmAddCustomTargetCommand.cxx cmAddCustomTargetCommand.h 
	cmMakefile.cxx cmMakefile.h 
Log Message:
ENH: Added COMMENT option to ADD_CUSTOM_TARGET.  This addresses bug#3461.


Index: cmAddCustomTargetCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmAddCustomTargetCommand.cxx,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- cmAddCustomTargetCommand.cxx	28 Sep 2006 17:55:25 -0000	1.24
+++ cmAddCustomTargetCommand.cxx	4 Oct 2006 22:10:29 -0000	1.25
@@ -59,12 +59,15 @@
   std::vector<std::string> depends;
   std::string working_directory;
   bool verbatim = false;
+  std::string comment_buffer;
+  const char* comment = 0;
 
   // Keep track of parser state.
   enum tdoing {
     doing_command,
     doing_depends,
     doing_working_directory,
+    doing_comment,
     doing_verbatim
   };
   tdoing doing = doing_command;
@@ -99,6 +102,10 @@
       doing = doing_verbatim;
       verbatim = true;
       }
+    else if (copy == "COMMENT")
+      {
+      doing = doing_comment;
+      }
     else if(copy == "COMMAND")
       {
       doing = doing_command;
@@ -123,6 +130,10 @@
         case doing_depends:
           depends.push_back(copy);
           break;
+         case doing_comment:
+           comment_buffer = copy;
+           comment = comment_buffer.c_str();
+           break;
         default:
           this->SetError("Wrong syntax. Unknown type of argument.");
           return false;
@@ -151,7 +162,7 @@
   bool escapeOldStyle = !verbatim;
   this->Makefile->AddUtilityCommand(args[0].c_str(), all,
                                     working_directory.c_str(), depends,
-                                    commandLines, escapeOldStyle);
+                                    commandLines, escapeOldStyle, comment);
 
   return true;
 }

Index: cmAddCustomTargetCommand.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmAddCustomTargetCommand.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- cmAddCustomTargetCommand.h	28 Sep 2006 15:30:46 -0000	1.19
+++ cmAddCustomTargetCommand.h	4 Oct 2006 22:10:29 -0000	1.20
@@ -66,7 +66,8 @@
       "  ADD_CUSTOM_TARGET(Name [ALL] [command1 [args1...]]\n"
       "                    [COMMAND command2 [args2...] ...]\n"
       "                    [DEPENDS depend depend depend ... ]\n"
-      "                    [WORKING_DIRECTORY dir] [VERBATIM])\n"
+      "                    [WORKING_DIRECTORY dir]\n"
+      "                    [COMMENT comment] [VERBATIM])\n"
       "Adds a target with the given name that executes the given commands. "
       "The target has no output file and is ALWAYS CONSIDERED OUT OF DATE "
       "even if the commands try to create a file with the name of the "
@@ -81,6 +82,8 @@
       "empty target will be created. "
       "If WORKING_DIRECTORY is set, then the command will be run in that "
       "directory. "
+      "If COMMENT is set, the value will be displayed as a "
+      "message before the commands are executed at build time. "
       "Dependencies listed with the DEPENDS argument may reference files "
       "and outputs of custom commands created with ADD_CUSTOM_COMMAND.\n"
       "If VERBATIM is given then all the arguments to the commands will be "

Index: cmMakefile.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefile.h,v
retrieving revision 1.194
retrieving revision 1.195
diff -u -d -r1.194 -r1.195
--- cmMakefile.h	4 Oct 2006 18:37:41 -0000	1.194
+++ cmMakefile.h	4 Oct 2006 22:10:29 -0000	1.195
@@ -195,7 +195,8 @@
                          const char* workingDirectory,
                          const std::vector<std::string>& depends,
                          const cmCustomCommandLines& commandLines,
-                         bool escapeOldStyle = true);
+                         bool escapeOldStyle = true,
+                         const char* comment = 0);
 
   /**
    * Add a link library to the build.

Index: cmMakefile.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefile.cxx,v
retrieving revision 1.358
retrieving revision 1.359
diff -u -d -r1.358 -r1.359
--- cmMakefile.cxx	4 Oct 2006 18:37:41 -0000	1.358
+++ cmMakefile.cxx	4 Oct 2006 22:10:29 -0000	1.359
@@ -823,7 +823,7 @@
                                    const char* workingDirectory,
                                    const std::vector<std::string>& depends,
                                    const cmCustomCommandLines& commandLines,
-                                   bool escapeOldStyle)
+                                   bool escapeOldStyle, const char* comment)
 {
   // Create a target instance for this utility.
   cmTarget target;
@@ -831,17 +831,22 @@
   target.SetInAll(all);
   target.SetMakefile(this);
 
+  if(!comment)
+    {
+    // Use an empty comment to avoid generation of default comment.
+    comment = "";
+    }
+
   // Store the custom command in the target.
   std::string force = this->GetStartOutputDirectory();
   force += cmake::GetCMakeFilesDirectory();
   force += "/";
   force += utilityName;
   const char* no_main_dependency = 0;
-  const char* empty_comment = "";
   bool no_replace = false;
   this->AddCustomCommandToOutput(force.c_str(), depends,
                                  no_main_dependency,
-                                 commandLines, empty_comment,
+                                 commandLines, comment,
                                  workingDirectory, no_replace,
                                  escapeOldStyle);
   target.GetSourceLists().push_back(force);



More information about the Cmake-commits mailing list