summaryrefslogtreecommitdiffstats
path: root/Tests/CustomCommand
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2007-06-11 17:22:17 (GMT)
committerBrad King <brad.king@kitware.com>2007-06-11 17:22:17 (GMT)
commit0f4ad19ef8add833dd362094b01cc832d44e59fc (patch)
tree6fc0f70a90471e95dcd108de80323f89a7681882 /Tests/CustomCommand
parentdfb79bea2371f2d8b2c45f791f93bb418f457217 (diff)
downloadCMake-0f4ad19ef8add833dd362094b01cc832d44e59fc.zip
CMake-0f4ad19ef8add833dd362094b01cc832d44e59fc.tar.gz
CMake-0f4ad19ef8add833dd362094b01cc832d44e59fc.tar.bz2
ENH: Re-arranged code to test adding a custom command to generate a source file after the file has been added to a target. This is supported by the current implementation because of the use of source lists in the target implementation. When we later convert to creating cmSourceFile instances immediately for the target we need to make sure the mentioned case still works.
Diffstat (limited to 'Tests/CustomCommand')
-rw-r--r--Tests/CustomCommand/CMakeLists.txt21
1 files changed, 9 insertions, 12 deletions
diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt
index 01d1dad..669fbb8 100644
--- a/Tests/CustomCommand/CMakeLists.txt
+++ b/Tests/CustomCommand/CMakeLists.txt
@@ -27,15 +27,6 @@ ADD_EXECUTABLE(generator generator.cxx)
GET_TARGET_PROPERTY(generator_PATH generator LOCATION)
MESSAGE("Location ${generator_PATH}")
-# the folowing assumes that a cmSourceFile
-# is instantiated for the output, with GENERATED 1
-# at the end of the day this becomes a what in VS ?
-ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/generated.c
- DEPENDS generator
- COMMAND ${generator_PATH}
- ARGS ${PROJECT_BINARY_DIR}/generated.c
- )
-
################################################################
#
# Test using a wrapper to wrap a header file
@@ -44,9 +35,6 @@ ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/generated.c
# add the executable that will generate the file
ADD_EXECUTABLE(wrapper wrapper.cxx)
-# the following assumes that a cmSourceFile
-# is instantiated for the output, with GENERATED 1
-# at the end of the day this becomes a what in VS ?
ADD_CUSTOM_COMMAND(
OUTPUT ${PROJECT_BINARY_DIR}/wrapped.c ${PROJECT_BINARY_DIR}/wrapped_help.c
DEPENDS wrapper
@@ -161,6 +149,15 @@ ADD_EXECUTABLE(CustomCommand
${PROJECT_BINARY_DIR}/not_included.h
)
+# Add the rule to create generated.c at build time. This is placed
+# here to test adding the generation rule after referencing the
+# generated source in a target.
+ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/generated.c
+ DEPENDS generator
+ COMMAND ${generator_PATH}
+ ARGS ${PROJECT_BINARY_DIR}/generated.c
+ )
+
TARGET_LINK_LIBRARIES(CustomCommand GeneratedHeader)
# must add a dependency on TDocument otherwise it might never build and