[cmake-commits] king committed CMakeLists.txt 1.5 1.6 dep_custom.cxx NONE 1.1 zot.cxx 1.1 1.2

cmake-commits at cmake.org cmake-commits at cmake.org
Fri Dec 21 12:22:14 EST 2007


Update of /cvsroot/CMake/CMake/Tests/BuildDepends/Project
In directory public:/mounts/ram/cvs-serv21743/Tests/BuildDepends/Project

Modified Files:
	CMakeLists.txt zot.cxx 
Added Files:
	dep_custom.cxx 
Log Message:
ENH: Add a depends check step to custom targets.  Add support for the IMPLICIT_DEPENDS feature of custom commands when building in custom targets.  Convert multiple-output pair checks to be per-target instead of global.


--- NEW FILE: dep_custom.cxx ---
#include <zot_custom.hxx.in>

Index: CMakeLists.txt
===================================================================
RCS file: /cvsroot/CMake/CMake/Tests/BuildDepends/Project/CMakeLists.txt,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- CMakeLists.txt	17 Sep 2007 14:51:05 -0000	1.5
+++ CMakeLists.txt	21 Dec 2007 17:22:12 -0000	1.6
@@ -32,9 +32,12 @@
 IF("${CMAKE_GENERATOR}" MATCHES "Make")
   # Test the IMPLICIT_DEPENDS feature.
   SET(ZOT_DEPENDS IMPLICIT_DEPENDS CXX ${CMAKE_CURRENT_SOURCE_DIR}/dep.cxx)
+  SET(ZOT_CUSTOM_DEP
+    IMPLICIT_DEPENDS CXX ${CMAKE_CURRENT_SOURCE_DIR}/dep_custom.cxx)
 ELSE("${CMAKE_GENERATOR}" MATCHES "Make")
   # No IMPLICIT_DEPENDS...just depend directly.
   SET(ZOT_DEPENDS DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/zot.hxx.in)
+  SET(ZOT_CUSTOM_DEP DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/zot_custom.hxx.in)
 ENDIF("${CMAKE_GENERATOR}" MATCHES "Make")
 add_custom_command(
   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/zot.hxx
@@ -44,4 +47,15 @@
   ${ZOT_DEPENDS}
   )
 
+add_custom_command(
+  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/zot_custom.hxx
+  COMMAND ${CMAKE_COMMAND} -E copy
+  ${CMAKE_CURRENT_BINARY_DIR}/zot_custom.hxx.in
+  ${CMAKE_CURRENT_BINARY_DIR}/zot_custom.hxx
+  ${ZOT_CUSTOM_DEP}
+  )
+add_custom_target(zot_custom ALL DEPENDS
+  ${CMAKE_CURRENT_BINARY_DIR}/zot_custom.hxx)
+
 add_executable(zot zot.cxx ${CMAKE_CURRENT_BINARY_DIR}/zot.hxx)
+add_dependencies(zot zot_custom)

Index: zot.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Tests/BuildDepends/Project/zot.cxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- zot.cxx	17 Sep 2007 14:51:05 -0000	1.1
+++ zot.cxx	21 Dec 2007 17:22:12 -0000	1.2
@@ -1,9 +1,10 @@
 #include <zot.hxx>
+#include <zot_custom.hxx>
 #include <stdio.h>
 
 int main()
 {
-  printf("%s\n", zot);
+  printf("[%s] [%s]\n", zot, zot_custom);
   fflush(stdout);
   return 0;
 }



More information about the Cmake-commits mailing list