summaryrefslogtreecommitdiffstats
path: root/Tests/CustomCommand
diff options
context:
space:
mode:
authorAlexander Neundorf <neundorf@kde.org>2007-05-09 12:25:45 (GMT)
committerAlexander Neundorf <neundorf@kde.org>2007-05-09 12:25:45 (GMT)
commit7f11536704d9f971cf5c8b0a2b490ccc6af58588 (patch)
tree05b5b24050a629bf9ceb59d743f77ca909448229 /Tests/CustomCommand
parent5af310502142252995ad5d74e66355be4094b7cc (diff)
downloadCMake-7f11536704d9f971cf5c8b0a2b490ccc6af58588.zip
CMake-7f11536704d9f971cf5c8b0a2b490ccc6af58588.tar.gz
CMake-7f11536704d9f971cf5c8b0a2b490ccc6af58588.tar.bz2
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
Diffstat (limited to 'Tests/CustomCommand')
-rw-r--r--Tests/CustomCommand/CMakeLists.txt25
-rw-r--r--Tests/CustomCommand/GeneratorInExtraDir/CMakeLists.txt6
-rw-r--r--Tests/CustomCommand/main.cxx6
3 files changed, 37 insertions, 0 deletions
diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt
index 83d2de2..fb7b714 100644
--- a/Tests/CustomCommand/CMakeLists.txt
+++ b/Tests/CustomCommand/CMakeLists.txt
@@ -168,6 +168,31 @@ TARGET_LINK_LIBRARIES(CustomCommand GeneratedHeader)
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
diff --git a/Tests/CustomCommand/GeneratorInExtraDir/CMakeLists.txt b/Tests/CustomCommand/GeneratorInExtraDir/CMakeLists.txt
new file mode 100644
index 0000000..e838e7b
--- /dev/null
+++ b/Tests/CustomCommand/GeneratorInExtraDir/CMakeLists.txt
@@ -0,0 +1,6 @@
+# add the executable which will be used for generating files
+ADD_EXECUTABLE(generator_extern ../generator.cxx)
+SET_TARGET_PROPERTIES(generator_extern PROPERTIES OUTPUT_NAME the_external_generator)
+
+# add an executable which will be called from ADD_CUSTOM_COMMAND( ... POST_BUILD)
+ADD_EXECUTABLE(dummy_generator ../generator.cxx)
diff --git a/Tests/CustomCommand/main.cxx b/Tests/CustomCommand/main.cxx
new file mode 100644
index 0000000..600e751
--- /dev/null
+++ b/Tests/CustomCommand/main.cxx
@@ -0,0 +1,6 @@
+extern int generated();
+
+int main()
+{
+ return generated();
+}