Merge topic 'byproduct-collapse-full-path'

3b409643bd Byproducts: Add test for collapsing of full paths in byproducts
445ff5ccdf Byproducts: collapse full paths of custom target byproducts

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3804
This commit is contained in:
Brad King
2019-09-17 15:11:55 +00:00
committed by Kitware Robot
6 changed files with 32 additions and 6 deletions
+1 -1
View File
@@ -127,7 +127,7 @@ bool cmAddCustomTargetCommand(std::vector<std::string> const& args,
}
filename += copy;
cmSystemTools::ConvertToUnixSlashes(filename);
byproducts.push_back(filename);
byproducts.push_back(cmSystemTools::CollapseFullPath(filename));
} break;
case doing_depends: {
std::string dep = copy;
+5 -5
View File
@@ -14,20 +14,20 @@ add_custom_command(
# Generate a byproduct in a rule that runs in a dependency of the consumer.
add_custom_command(
OUTPUT timestamp2.txt
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/../CustomCommandByproducts/timestamp2.txt
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_CURRENT_SOURCE_DIR}/byproduct2.c.in byproduct2.c
BYPRODUCTS byproduct2.c
BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/../CustomCommandByproducts/byproduct2.c
COMMAND ${CMAKE_COMMAND} -E touch timestamp2.txt
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/byproduct2.c.in
)
add_custom_target(Producer2 DEPENDS timestamp2.txt)
add_custom_target(Producer2 DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/timestamp2.txt)
# Generate a byproduct in a custom target.
add_custom_target(Producer3_4
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_CURRENT_SOURCE_DIR}/byproduct3.c.in byproduct3.c
BYPRODUCTS byproduct3.c
BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/../CustomCommandByproducts/byproduct3.c
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/byproduct3.c.in
)
@@ -36,7 +36,7 @@ add_custom_command(
TARGET Producer3_4 POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_CURRENT_SOURCE_DIR}/byproduct4.c.in byproduct4.c
BYPRODUCTS byproduct4.c
BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/../CustomCommandByproducts/byproduct4.c
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/byproduct4.c.in
)
@@ -0,0 +1,10 @@
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/../GeneratedProperty-build/a"
BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/../GeneratedProperty-build/b"
COMMAND c
)
get_source_file_property(GENERATED_A "${CMAKE_CURRENT_BINARY_DIR}/a" GENERATED)
get_source_file_property(GENERATED_B "${CMAKE_CURRENT_BINARY_DIR}/b" GENERATED)
if(NOT GENERATED_A OR NOT GENERATED_B)
message(FATAL_ERROR "failed")
endif()
@@ -3,6 +3,7 @@ include(RunCMake)
run_cmake(AppendNoOutput)
run_cmake(AppendNotOutput)
run_cmake(BadArgument)
run_cmake(GeneratedProperty)
run_cmake(NoArguments)
run_cmake(NoOutputOrTarget)
run_cmake(OutputAndTarget)
@@ -0,0 +1,14 @@
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/../GeneratedProperty-build/a"
COMMAND b
)
add_custom_target(CollapseFullPath
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/a"
BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/../GeneratedProperty-build/c"
COMMAND d
)
get_source_file_property(GENERATED_A "${CMAKE_CURRENT_BINARY_DIR}/a" GENERATED)
get_source_file_property(GENERATED_C "${CMAKE_CURRENT_BINARY_DIR}/c" GENERATED)
if(NOT GENERATED_A OR NOT GENERATED_C)
message(FATAL_ERROR "failed")
endif()
@@ -1,6 +1,7 @@
include(RunCMake)
run_cmake(CommandExpandsEmpty)
run_cmake(GeneratedProperty)
run_cmake(NoArguments)
run_cmake(BadTargetName)
run_cmake(ByproductsNoCommand)