diff options
author | Brad King <brad.king@kitware.com> | 2018-09-28 15:16:47 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2018-09-28 15:17:09 (GMT) |
commit | cac09cc52ccba9f3435e4d7cc227d15b6a009855 (patch) | |
tree | 5befeddbc7b7e6d94024b0e221c4528df335e4f7 /Tests | |
parent | 4e98203c6c318f7c2caf4c31b2c2863772eef57b (diff) | |
parent | f158ac19e1e52362b04ff08c309ac3cf8e429bb7 (diff) | |
download | CMake-cac09cc52ccba9f3435e4d7cc227d15b6a009855.zip CMake-cac09cc52ccba9f3435e4d7cc227d15b6a009855.tar.gz CMake-cac09cc52ccba9f3435e4d7cc227d15b6a009855.tar.bz2 |
Merge topic 'customcommandworkingdirectory'
f158ac19e1 add_custom_{command,target}: WORKING_DIRECTORY generator expressions
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2409
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) |