Tests: Update CustomCommandWorkingDirectory to handle in-source byproducts

When running an in-source build the CustomCommandWorkingDirectory test
created a copy of a source file in the same directory it was running on.
This breaks when byproducts are cleaned (e.g. via Ninja) because it
deletes one of the source files.
This commit is contained in:
Pedro Navarro
2018-09-27 16:57:51 -07:00
committed by Brad King
parent cac09cc52c
commit 9c2b393cb7

View File

@@ -9,17 +9,17 @@ add_custom_command(
)
set_source_files_properties(
"${TestWorkingDir_BINARY_DIR}/customTarget.c"
"${TestWorkingDir_BINARY_DIR}/customTarget1.c"
"${TestWorkingDir_BINARY_DIR}/customTarget2.c"
PROPERTIES GENERATED 1)
add_executable(working "${TestWorkingDir_BINARY_DIR}/working.c"
"${TestWorkingDir_BINARY_DIR}/customTarget.c")
"${TestWorkingDir_BINARY_DIR}/customTarget1.c")
add_custom_target(
Custom ALL
COMMAND "${CMAKE_COMMAND}" -E copy_if_different ./customTarget.c "${TestWorkingDir_BINARY_DIR}/customTarget.c"
BYPRODUCTS "${TestWorkingDir_BINARY_DIR}/customTarget.c"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different ./customTarget.c "${TestWorkingDir_BINARY_DIR}/customTarget1.c"
BYPRODUCTS "${TestWorkingDir_BINARY_DIR}/customTarget1.c"
WORKING_DIRECTORY "${TestWorkingDir_SOURCE_DIR}"
)