summaryrefslogtreecommitdiffstats
path: root/Tests/BuildDepends
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-12-05 14:56:26 (GMT)
committerBrad King <brad.king@kitware.com>2014-12-05 14:56:26 (GMT)
commit65ea5eb721d820551653bf6471e83ed5f4a5ba13 (patch)
tree32eb05579e0b909a5498d6ffa467269c2c2c5161 /Tests/BuildDepends
parent644b4688d71cc52f8499d6103495de0909319557 (diff)
downloadCMake-65ea5eb721d820551653bf6471e83ed5f4a5ba13.zip
CMake-65ea5eb721d820551653bf6471e83ed5f4a5ba13.tar.gz
CMake-65ea5eb721d820551653bf6471e83ed5f4a5ba13.tar.bz2
Tests: Cover rebuild with multiple custom command outputs (#15116)
Extend the BuildDepends test with a case covering multiple custom command outputs with the second one consumed by another rule. With the old "multiple output pair" infrastructure used in the Makefile and Xcode generators this did not work. Now that it is fixed, test the case explicitly.
Diffstat (limited to 'Tests/BuildDepends')
-rw-r--r--Tests/BuildDepends/CMakeLists.txt28
-rw-r--r--Tests/BuildDepends/Project/CMakeLists.txt13
2 files changed, 41 insertions, 0 deletions
diff --git a/Tests/BuildDepends/CMakeLists.txt b/Tests/BuildDepends/CMakeLists.txt
index 6209bb8..78e9e17 100644
--- a/Tests/BuildDepends/CMakeLists.txt
+++ b/Tests/BuildDepends/CMakeLists.txt
@@ -65,6 +65,7 @@ file(WRITE ${BuildDepends_BINARY_DIR}/Project/link_depends_no_shared_exe.h
set(link_depends_no_shared_check_txt ${BuildDepends_BINARY_DIR}/Project/link_depends_no_shared_check.txt)
file(WRITE ${BuildDepends_BINARY_DIR}/Project/external.in "external original\n")
+file(WRITE ${BuildDepends_BINARY_DIR}/Project/multi1-in.txt "multi1-in original\n")
help_xcode_depends()
@@ -177,6 +178,19 @@ else()
"external.out is missing")
endif()
+if(EXISTS ${BuildDepends_BINARY_DIR}/Project/multi1-out2-copy.txt)
+ file(STRINGS ${BuildDepends_BINARY_DIR}/Project/multi1-out2-copy.txt multi1_out)
+ if("${multi1_out}" STREQUAL "multi1-in original")
+ message(STATUS "multi1-out2-copy.txt contains '${multi1_out}'")
+ else()
+ message(SEND_ERROR "Project did not initially build properly: "
+ "multi1-out2-copy.txt contains '${multi1_out}'")
+ endif()
+else()
+ message(SEND_ERROR "Project did not initially build properly: "
+ "multi1-out2-copy.txt is missing")
+endif()
+
message("Waiting 3 seconds...")
execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 3)
@@ -202,6 +216,7 @@ if(TEST_LINK_DEPENDS)
endif()
file(WRITE ${BuildDepends_BINARY_DIR}/Project/external.in "external changed\n")
+file(WRITE ${BuildDepends_BINARY_DIR}/Project/multi1-in.txt "multi1-in changed\n")
help_xcode_depends()
@@ -319,3 +334,16 @@ else()
message(SEND_ERROR "Project did not rebuild properly: "
"external.out is missing")
endif()
+
+if(EXISTS ${BuildDepends_BINARY_DIR}/Project/multi1-out2-copy.txt)
+ file(STRINGS ${BuildDepends_BINARY_DIR}/Project/multi1-out2-copy.txt multi1_out)
+ if("${multi1_out}" STREQUAL "multi1-in changed")
+ message(STATUS "multi1-out2-copy.txt contains '${multi1_out}'")
+ else()
+ message(SEND_ERROR "Project did not rebuild properly: "
+ "multi1-out2-copy.txt contains '${multi1_out}'")
+ endif()
+else()
+ message(SEND_ERROR "Project did not rebuild properly: "
+ "multi1-out2-copy.txt is missing")
+endif()
diff --git a/Tests/BuildDepends/Project/CMakeLists.txt b/Tests/BuildDepends/Project/CMakeLists.txt
index 9ee4a43..cb9fbf8 100644
--- a/Tests/BuildDepends/Project/CMakeLists.txt
+++ b/Tests/BuildDepends/Project/CMakeLists.txt
@@ -151,3 +151,16 @@ ExternalProject_Add(ExternalBuild
-Dexternal_out=${CMAKE_CURRENT_BINARY_DIR}/external.out
INSTALL_COMMAND ""
)
+
+add_custom_command(
+ OUTPUT multi1-out1.txt multi1-out2.txt
+ COMMAND ${CMAKE_COMMAND} -E copy multi1-in.txt multi1-out1.txt
+ COMMAND ${CMAKE_COMMAND} -E copy multi1-in.txt multi1-out2.txt
+ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/multi1-in.txt
+ )
+add_custom_command(
+ OUTPUT multi1-out2-copy.txt
+ COMMAND ${CMAKE_COMMAND} -E copy multi1-out2.txt multi1-out2-copy.txt
+ DEPENDS multi1-out2.txt
+ )
+add_custom_target(multi1 ALL DEPENDS multi1-out2-copy.txt)