diff options
author | Brad King <brad.king@kitware.com> | 2015-04-13 13:06:07 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2015-04-13 13:06:07 (GMT) |
commit | e0adfe61122da9387d450e4647da26865483d680 (patch) | |
tree | a85ed63c759fa11dbed8a557c995d25cae0104ee /Tests | |
parent | 1862b39868b5a0c256d0256ac7c71e52e59e7155 (diff) | |
parent | 9660a3cceae12ebb3cdc49484dcef590a12eb33c (diff) | |
download | CMake-e0adfe61122da9387d450e4647da26865483d680.zip CMake-e0adfe61122da9387d450e4647da26865483d680.tar.gz CMake-e0adfe61122da9387d450e4647da26865483d680.tar.bz2 |
Merge topic 'custom-command-multiple-outputs'
9660a3cc Makefile: Fix multiple custom command outputs with one missing
5c08e255 KWSys SystemTools: Teach Touch with !create to succeed on missing file
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/BuildDepends/CMakeLists.txt | 65 | ||||
-rw-r--r-- | Tests/BuildDepends/Project/CMakeLists.txt | 18 |
2 files changed, 83 insertions, 0 deletions
diff --git a/Tests/BuildDepends/CMakeLists.txt b/Tests/BuildDepends/CMakeLists.txt index 78e9e17..2be59b6 100644 --- a/Tests/BuildDepends/CMakeLists.txt +++ b/Tests/BuildDepends/CMakeLists.txt @@ -42,6 +42,11 @@ list(APPEND _cmake_options "-DTEST_LINK_DEPENDS=${TEST_LINK_DEPENDS}") list(APPEND _cmake_options "-DCMAKE_FORCE_DEPFILES=1") +if(NOT CMAKE_GENERATOR MATCHES "Visual Studio ([^6789]|[6789][0-9])") + set(TEST_MULTI3 1) + list(APPEND _cmake_options "-DTEST_MULTI3=1") +endif() + file(MAKE_DIRECTORY ${BuildDepends_BINARY_DIR}/Project) message("Creating Project/foo.cxx") write_file(${BuildDepends_BINARY_DIR}/Project/foo.cxx @@ -66,6 +71,8 @@ set(link_depends_no_shared_check_txt ${BuildDepends_BINARY_DIR}/Project/link_dep file(WRITE ${BuildDepends_BINARY_DIR}/Project/external.in "external original\n") file(WRITE ${BuildDepends_BINARY_DIR}/Project/multi1-in.txt "multi1-in original\n") +file(WRITE ${BuildDepends_BINARY_DIR}/Project/multi2-stamp.txt "multi2-stamp original\n") +file(WRITE ${BuildDepends_BINARY_DIR}/Project/multi3-stamp.txt "multi3-stamp original\n") help_xcode_depends() @@ -191,6 +198,34 @@ else() "multi1-out2-copy.txt is missing") endif() +if(EXISTS ${BuildDepends_BINARY_DIR}/Project/multi2-real.txt) + if(${BuildDepends_BINARY_DIR}/Project/multi2-real.txt + IS_NEWER_THAN ${BuildDepends_BINARY_DIR}/Project/multi2-stamp.txt) + message(STATUS "multi2-real.txt is newer than multi2-stamp.txt") + else() + message(SEND_ERROR "Project did not initially build properly: " + "multi2-real.txt is not newer than multi2-stamp.txt") + endif() +else() + message(SEND_ERROR "Project did not initially build properly: " + "multi2-real.txt is missing") +endif() + +if(TEST_MULTI3) + if(EXISTS ${BuildDepends_BINARY_DIR}/Project/multi3-real.txt) + if(${BuildDepends_BINARY_DIR}/Project/multi3-real.txt + IS_NEWER_THAN ${BuildDepends_BINARY_DIR}/Project/multi3-stamp.txt) + message(STATUS "multi3-real.txt is newer than multi3-stamp.txt") + else() + message(SEND_ERROR "Project did not initially build properly: " + "multi3-real.txt is not newer than multi3-stamp.txt") + endif() + else() + message(SEND_ERROR "Project did not initially build properly: " + "multi3-real.txt is missing") + endif() +endif() + message("Waiting 3 seconds...") execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 3) @@ -217,6 +252,8 @@ 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") +file(WRITE ${BuildDepends_BINARY_DIR}/Project/multi2-stamp.txt "multi2-stamp changed\n") +file(WRITE ${BuildDepends_BINARY_DIR}/Project/multi3-stamp.txt "multi3-stamp changed\n") help_xcode_depends() @@ -347,3 +384,31 @@ else() message(SEND_ERROR "Project did not rebuild properly: " "multi1-out2-copy.txt is missing") endif() + +if(EXISTS ${BuildDepends_BINARY_DIR}/Project/multi2-real.txt) + if(${BuildDepends_BINARY_DIR}/Project/multi2-real.txt + IS_NEWER_THAN ${BuildDepends_BINARY_DIR}/Project/multi2-stamp.txt) + message(STATUS "multi2-real.txt is newer than multi2-stamp.txt") + else() + message(SEND_ERROR "Project did not rebuild properly: " + "multi2-real.txt is not newer than multi2-stamp.txt") + endif() +else() + message(SEND_ERROR "Project did not rebuild properly: " + "multi2-real.txt is missing") +endif() + +if(TEST_MULTI3) + if(EXISTS ${BuildDepends_BINARY_DIR}/Project/multi3-real.txt) + if(${BuildDepends_BINARY_DIR}/Project/multi3-real.txt + IS_NEWER_THAN ${BuildDepends_BINARY_DIR}/Project/multi3-stamp.txt) + message(STATUS "multi3-real.txt is newer than multi3-stamp.txt") + else() + message(SEND_ERROR "Project did not rebuild properly: " + "multi3-real.txt is not newer than multi3-stamp.txt") + endif() + else() + message(SEND_ERROR "Project did not rebuild properly: " + "multi3-real.txt is missing") + endif() +endif() diff --git a/Tests/BuildDepends/Project/CMakeLists.txt b/Tests/BuildDepends/Project/CMakeLists.txt index cb9fbf8..0db39c5 100644 --- a/Tests/BuildDepends/Project/CMakeLists.txt +++ b/Tests/BuildDepends/Project/CMakeLists.txt @@ -164,3 +164,21 @@ add_custom_command( DEPENDS multi1-out2.txt ) add_custom_target(multi1 ALL DEPENDS multi1-out2-copy.txt) + +# Test having the first output never created. +add_custom_command( + OUTPUT multi2-dummy.txt multi2-real.txt + COMMAND ${CMAKE_COMMAND} -E touch multi2-real.txt + ) +set_property(SOURCE multi2-real.txt multi2-dummy.txt PROPERTY SYMBOLIC 1) +add_custom_target(multi2 ALL DEPENDS multi2-real.txt) + +if(TEST_MULTI3) + # Test having the second output never created. Does not work with msbuild. + add_custom_command( + OUTPUT multi3-real.txt multi3-dummy.txt + COMMAND ${CMAKE_COMMAND} -E touch multi3-real.txt + ) + set_property(SOURCE multi3-real.txt multi3-dummy.txt PROPERTY SYMBOLIC 1) + add_custom_target(multi3 ALL DEPENDS multi3-real.txt) +endif() |