diff options
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CustomCommand/CMakeLists.txt | 25 | ||||
-rw-r--r-- | Tests/CustomCommand/GeneratorInExtraDir/CMakeLists.txt | 6 | ||||
-rw-r--r-- | Tests/CustomCommand/main.cxx | 6 |
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(); +} |