diff options
author | Jon Chronopoulos <patches@crondog.com> | 2018-09-22 07:00:28 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-09-28 15:15:33 (GMT) |
commit | f158ac19e1e52362b04ff08c309ac3cf8e429bb7 (patch) | |
tree | 38b224fd9717f4ac18a2e82088fb9461cbbbab00 /Tests/CustomCommandWorkingDirectory | |
parent | 2d119e53093c9489c80ce9bc3f21eadc254b6e10 (diff) | |
download | CMake-f158ac19e1e52362b04ff08c309ac3cf8e429bb7.zip CMake-f158ac19e1e52362b04ff08c309ac3cf8e429bb7.tar.gz CMake-f158ac19e1e52362b04ff08c309ac3cf8e429bb7.tar.bz2 |
add_custom_{command,target}: WORKING_DIRECTORY generator expressions
This teaches add_custom_command and add_custom_target WORKING_DIRECTORY
about generator expressions
Fixes: #14089
Diffstat (limited to 'Tests/CustomCommandWorkingDirectory')
-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) |