[cmake-commits] alex committed CMakeLists.txt 1.27 1.28 main.cxx 1.1 1.2

cmake-commits at cmake.org cmake-commits at cmake.org
Wed May 9 08:25:47 EDT 2007


Update of /cvsroot/CMake/CMake/Tests/CustomCommand
In directory public:/mounts/ram/cvs-serv22971/Tests/CustomCommand

Modified Files:
	CMakeLists.txt 
Added Files:
	main.cxx 
Log Message:

ENH: now target names can be used in add_custom_command() and
add_custom_target() as COMMAND, and cmake will recognize them and replace
them with the actual output path of these executables. Also the dependency
will be added automatically. Test included.
ENH: moved TraceVSDependencies() to the end of GlobalGenerator::Configure(),
so it is done now in one central place

Alex


--- NEW FILE: main.cxx ---
extern int generated();

int main()
{
  return generated();
}

Index: CMakeLists.txt
===================================================================
RCS file: /cvsroot/CMake/CMake/Tests/CustomCommand/CMakeLists.txt,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- CMakeLists.txt	1 May 2007 18:12:56 -0000	1.27
+++ CMakeLists.txt	9 May 2007 12:25:45 -0000	1.28
@@ -168,6 +168,31 @@
 ADD_DEPENDENCIES(CustomCommand TDocument)
 
 ##############################################################################
+# Test for using just the target name as executable in the COMMAND
+# section. Has to be recognized and replaced by CMake with the output
+# actual location of the executable.
+# Additionally the generator is created in an extra subdir after the 
+# ADD_CUSTOM_COMMAND() is used.
+#
+# Test the same for ADD_CUSTOM_TARGET()
+
+ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/generated_extern.cxx
+  COMMAND generator_extern ${CMAKE_CURRENT_BINARY_DIR}/generated_extern.cxx
+  )
+
+ADD_EXECUTABLE(CustomCommandUsingTargetTest main.cxx ${CMAKE_CURRENT_BINARY_DIR}/generated_extern.cxx )
+
+ADD_CUSTOM_TARGET(RunTarget 
+  COMMAND generator_extern ${CMAKE_CURRENT_BINARY_DIR}/run_target.cxx
+  )
+
+ADD_CUSTOM_COMMAND(TARGET CustomCommandUsingTargetTest POST_BUILD 
+                   COMMAND dummy_generator ${CMAKE_CURRENT_BINARY_DIR}/generated_dummy.cxx)
+
+ADD_SUBDIRECTORY(GeneratorInExtraDir)
+
+
+##############################################################################
 # Test non-trivial command line arguments in custom commands.
 SET(EXPECTED_ARGUMENTS)
 SET(CHECK_ARGS



More information about the Cmake-commits mailing list