diff options
Diffstat (limited to 'Tests/CustomCommand')
-rw-r--r-- | Tests/CustomCommand/CMakeLists.txt | 13 | ||||
-rw-r--r-- | Tests/CustomCommand/foo.in | 5 | ||||
-rw-r--r-- | Tests/CustomCommand/subdir.h.in | 1 |
3 files changed, 19 insertions, 0 deletions
diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt index b97cd16..7ef3540 100644 --- a/Tests/CustomCommand/CMakeLists.txt +++ b/Tests/CustomCommand/CMakeLists.txt @@ -153,6 +153,19 @@ add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/foo.c ${PROJECT_BINARY_DIR}/foo.c ) +# Test using OBJECT_DEPENDS to bring in a custom command. +# Use a path that can be simplified to make sure paths +# are consistently normalized. +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/subdir/../subdir/subdir.h + COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_CURRENT_SOURCE_DIR}/subdir.h.in + ${CMAKE_CURRENT_BINARY_DIR}/subdir/subdir.h + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/subdir.h.in + ) +set_property(SOURCE ${PROJECT_BINARY_DIR}/foo.c PROPERTY + OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/subdir/../subdir/subdir.h) + # Add custom command to generate not_included.h, which is a header # file that is not included by any source in this project. This will # test whether all custom command outputs explicitly listed as sources diff --git a/Tests/CustomCommand/foo.in b/Tests/CustomCommand/foo.in index 0c5021c..5ca6315 100644 --- a/Tests/CustomCommand/foo.in +++ b/Tests/CustomCommand/foo.in @@ -7,6 +7,11 @@ int generated(); int wrapped(); +#include "subdir/subdir.h" +#ifndef SUBDIR_DEF +# error SUBDIR_DEF not defined +#endif + int main () { if (generated()*wrapped()*doc() == 3*5*7) diff --git a/Tests/CustomCommand/subdir.h.in b/Tests/CustomCommand/subdir.h.in new file mode 100644 index 0000000..1e50750 --- /dev/null +++ b/Tests/CustomCommand/subdir.h.in @@ -0,0 +1 @@ +#define SUBDIR_DEF |