summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2005-04-26 15:55:20 (GMT)
committerBrad King <brad.king@kitware.com>2005-04-26 15:55:20 (GMT)
commit0af2597bd8d99a6186c05c27e9ed1c13e73088d7 (patch)
tree1408a38d35b26ed7cd39e7549f4c7d022a4341d2
parentd381fbfa380cc419c2e967e948f8d908020a273c (diff)
downloadCMake-0af2597bd8d99a6186c05c27e9ed1c13e73088d7.zip
CMake-0af2597bd8d99a6186c05c27e9ed1c13e73088d7.tar.gz
CMake-0af2597bd8d99a6186c05c27e9ed1c13e73088d7.tar.bz2
ENH: Added pre-build and post-build test for custom targets.
-rw-r--r--Tests/CustomCommand/CMakeLists.txt21
1 files changed, 20 insertions, 1 deletions
diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt
index 162878b..89b2aa7 100644
--- a/Tests/CustomCommand/CMakeLists.txt
+++ b/Tests/CustomCommand/CMakeLists.txt
@@ -67,19 +67,38 @@ ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/doc1.dvi
ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/doc1.h
DEPENDS ${PROJECT_BINARY_DIR}/doc1.dvi
+ COMMAND ${CMAKE_COMMAND} -E echo " Copying doc1.dvi to doc1temp.h."
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/doc1.dvi
${PROJECT_BINARY_DIR}/doc1temp.h
+ COMMAND ${CMAKE_COMMAND} -E echo " Copying doc1temp.h to doc1.h."
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/doc1temp.h
${PROJECT_BINARY_DIR}/doc1.h
+ COMMAND ${CMAKE_COMMAND} -E echo " Removing doc1temp.h."
+ COMMAND ${CMAKE_COMMAND} -E remove -f ${PROJECT_BINARY_DIR}/doc1temp.h
)
+# Add a custom target to drive generation of doc1.h.
ADD_CUSTOM_TARGET(TDocument ALL
- COMMAND ${CMAKE_COMMAND} -E echo "Copying doc1.h to doc2.h."
+ COMMAND ${CMAKE_COMMAND} -E echo " Copying doc1.h to doc2.h."
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/doc1.h
${PROJECT_BINARY_DIR}/doc2.h
DEPENDS ${PROJECT_BINARY_DIR}/doc1.h
)
+# Setup a pre- and post-build pair that will fail if not run in the
+# proper order.
+ADD_CUSTOM_COMMAND(
+ TARGET TDocument PRE_BUILD
+ COMMAND ${CMAKE_COMMAND} -E echo " Writing doc1pre.txt."
+ COMMAND ${CMAKE_COMMAND} -E echo "Dummy" > ${PROJECT_BINARY_DIR}/doc1pre.txt
+ )
+ADD_CUSTOM_COMMAND(
+ TARGET TDocument POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E echo " Copying doc1pre.txt to doc2post.txt."
+ COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/doc1pre.txt
+ ${PROJECT_BINARY_DIR}/doc2post.txt
+ )
+
################################################################
#
# Test using a multistep generated file