diff options
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CustomCommandWorkingDirectory/CMakeLists.txt | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Tests/CustomCommandWorkingDirectory/CMakeLists.txt b/Tests/CustomCommandWorkingDirectory/CMakeLists.txt index 4975feb..5495a9b 100644 --- a/Tests/CustomCommandWorkingDirectory/CMakeLists.txt +++ b/Tests/CustomCommandWorkingDirectory/CMakeLists.txt @@ -42,3 +42,23 @@ add_custom_target( ) add_dependencies(working2 Custom2) + +file(MAKE_DIRECTORY ${TestWorkingDir_BINARY_DIR}/genex) +add_custom_command( + OUTPUT "${TestWorkingDir_BINARY_DIR}/genex/working.c" + COMMAND "${CMAKE_COMMAND}" -E copy "${TestWorkingDir_SOURCE_DIR}/working.c.in" "${TestWorkingDir_BINARY_DIR}/genex/working.c" + WORKING_DIRECTORY "${TestWorkingDir_BINARY_DIR}/$<1:genex>/" + COMMENT "custom command" +) + +add_executable(workinggenex "${TestWorkingDir_BINARY_DIR}/genex/working.c" + "${TestWorkingDir_BINARY_DIR}/genex/customTarget.c") + +add_custom_target( + CustomGenex ALL + COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${TestWorkingDir_SOURCE_DIR}/customTarget.c" "${TestWorkingDir_BINARY_DIR}/genex/customTarget.c" + BYPRODUCTS "${TestWorkingDir_BINARY_DIR}/genex/customTarget.c" + WORKING_DIRECTORY "${TestWorkingDir_BINARY_DIR}/$<1:genex>/" +) + +add_dependencies(workinggenex CustomGenex) |