summaryrefslogtreecommitdiff
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2005-08-17 11:48:05 -0400
committerBrad King <brad.king@kitware.com>2005-08-17 11:48:05 -0400
commit1774d306ee701be0e3257d3126fc437380edece4 (patch)
treec2d06fe8844a80d4854f103bfe3715367ee74ebd /Tests
parentf4920b83695726993acb8fdddf2d07bdef0655af (diff)
downloadcmake-1774d306ee701be0e3257d3126fc437380edece4.tar.gz
ENH: Adding test for auto-object-depends feature. It has been tested with the Makefile generator. Hopefully this will work for the Visual Studio and XCode generators.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CustomCommand/CMakeLists.txt20
-rw-r--r--Tests/CustomCommand/foo.h.in1
-rw-r--r--Tests/CustomCommand/foo.in1
3 files changed, 20 insertions, 2 deletions
diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt
index f9dbafe71a..2faa64d532 100644
--- a/Tests/CustomCommand/CMakeLists.txt
+++ b/Tests/CustomCommand/CMakeLists.txt
@@ -77,6 +77,17 @@ ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/doc1.h
COMMAND ${CMAKE_COMMAND} -E remove -f ${PROJECT_BINARY_DIR}/doc1temp.h
)
+# Add custom command to generate foo.h.
+ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/foo.h
+ DEPENDS ${PROJECT_SOURCE_DIR}/foo.h.in
+ COMMAND ${CMAKE_COMMAND} -E echo " Copying foo.h.in to foo.h."
+ COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/foo.h.in
+ ${PROJECT_BINARY_DIR}/foo.h
+ )
+
+# Add the location of foo.h to the include path.
+INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR})
+
# 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."
@@ -118,8 +129,13 @@ ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/foo.c
${PROJECT_BINARY_DIR}/foo.c
)
-SET_SOURCE_FILES_PROPERTIES(${PROJECT_BINARY_DIR}/foo.c PROPERTIES
- OBJECT_DEPENDS ${PROJECT_BINARY_DIR}/doc1.h)
+# This object dependency is removed to test the new
+# auto-object-depends feature. If the feature is removed these lines
+# must be restored.
+#SET_SOURCE_FILES_PROPERTIES(${PROJECT_BINARY_DIR}/foo.c PROPERTIES
+# OBJECT_DEPENDS ${PROJECT_BINARY_DIR}/doc1.h)
+#SET_SOURCE_FILES_PROPERTIES(${PROJECT_BINARY_DIR}/foo.c PROPERTIES
+# OBJECT_DEPENDS ${PROJECT_BINARY_DIR}/foo.h)
# add the library
ADD_EXECUTABLE(CustomCommand
diff --git a/Tests/CustomCommand/foo.h.in b/Tests/CustomCommand/foo.h.in
new file mode 100644
index 0000000000..d6a4a56cec
--- /dev/null
+++ b/Tests/CustomCommand/foo.h.in
@@ -0,0 +1 @@
+// Empty header file just used to test header generation.
diff --git a/Tests/CustomCommand/foo.in b/Tests/CustomCommand/foo.in
index a887264f6c..62b04b20b9 100644
--- a/Tests/CustomCommand/foo.in
+++ b/Tests/CustomCommand/foo.in
@@ -1,4 +1,5 @@
#include "doc1.h"
+#include "foo.h"
int generated();
int wrapped();