[cmake-commits] king committed cmAddCustomCommandCommand.cxx 1.36 1.37 cmAddCustomCommandCommand.h 1.32 1.33

cmake-commits at cmake.org cmake-commits at cmake.org
Wed Jan 30 11:22:12 EST 2008


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

Modified Files:
	cmAddCustomCommandCommand.cxx cmAddCustomCommandCommand.h 
Log Message:
ENH: Make add_custom_command interpret relative OUTPUT locations with respect to the build tre instead of the source tree.  This can greatly simplify user code since generating a file will not need to reference CMAKE_CURRENT_BINARY_DIR.  The new behavior is what users expect 99% of the time.


Index: cmAddCustomCommandCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmAddCustomCommandCommand.cxx,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- cmAddCustomCommandCommand.cxx	23 Jan 2008 15:27:59 -0000	1.36
+++ cmAddCustomCommandCommand.cxx	30 Jan 2008 16:22:10 -0000	1.37
@@ -152,7 +152,17 @@
         case doing_outputs:
           if (!cmSystemTools::FileIsFullPath(copy.c_str()))
             {
-            filename = this->Makefile->GetStartDirectory();
+            // This is an output to be generated, so it should be
+            // under the build tree.  CMake 2.4 placed this under the
+            // source tree.  However the only case that this change
+            // will break is when someone writes
+            //
+            //   add_custom_command(OUTPUT out.txt ...)
+            //
+            // and later references "${CMAKE_CURRENT_SOURCE_DIR}/out.txt".
+            // This is fairly obscure so we can wait for someone to
+            // complain.
+            filename = this->Makefile->GetCurrentOutputDirectory();
             filename += "/";
             }
           filename += copy;

Index: cmAddCustomCommandCommand.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmAddCustomCommandCommand.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- cmAddCustomCommandCommand.h	23 Jan 2008 15:27:59 -0000	1.32
+++ cmAddCustomCommandCommand.h	30 Jan 2008 16:22:10 -0000	1.33
@@ -78,6 +78,9 @@
       "This defines a new command that can be executed during the build "
       "process. The outputs named should be listed as source files in the "
       "target for which they are to be generated. "
+      "If an output name is a relative path it will be interpreted "
+      "relative to the build tree directory corresponding to the current "
+      "source directory. "
       "Note that MAIN_DEPENDENCY is completely optional and is "
       "used as a suggestion to visual studio about where to hang the "
       "custom command. In makefile terms this creates a new target in the "



More information about the Cmake-commits mailing list