diff options
author | Brad King <brad.king@kitware.com> | 2015-07-22 11:15:20 -0400 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-07-22 11:37:47 -0400 |
commit | 783c375766b1e5656dd34dd99281fceb7ed7aab2 (patch) | |
tree | 1c1d9074ea0f3e9aac7d306f68f2cc47e155f80e /Tests/BuildDepends/CMakeLists.txt | |
parent | e00e8713de13570b8ca41291c0a863a8be00686c (diff) | |
download | cmake-783c375766b1e5656dd34dd99281fceb7ed7aab2.tar.gz |
Tests: Extend BuildDepends test to cover OBJECT_DEPENDS
The actual file timestamp dependency is known to not work on
Visual Studio or Xcode generators. Tolerate such failure for
these generators (Tests/CustomCommand already covers using
OBJECT_DEPENDS to pull a custom command into a target, and
that still works with these generators).
Diffstat (limited to 'Tests/BuildDepends/CMakeLists.txt')
-rw-r--r-- | Tests/BuildDepends/CMakeLists.txt | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Tests/BuildDepends/CMakeLists.txt b/Tests/BuildDepends/CMakeLists.txt index 2be59b61c2..7b7353c7de 100644 --- a/Tests/BuildDepends/CMakeLists.txt +++ b/Tests/BuildDepends/CMakeLists.txt @@ -69,6 +69,9 @@ file(WRITE ${BuildDepends_BINARY_DIR}/Project/link_depends_no_shared_exe.h "#define link_depends_no_shared_exe_value 0\n") set(link_depends_no_shared_check_txt ${BuildDepends_BINARY_DIR}/Project/link_depends_no_shared_check.txt) +file(WRITE ${BuildDepends_BINARY_DIR}/Project/object_depends.txt "0\n") +set(object_depends_check_txt ${BuildDepends_BINARY_DIR}/Project/object_depends_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") file(WRITE ${BuildDepends_BINARY_DIR}/Project/multi2-stamp.txt "multi2-stamp original\n") @@ -246,6 +249,8 @@ file(WRITE ${BuildDepends_BINARY_DIR}/Project/zot_macro_tgt.hxx file(WRITE ${BuildDepends_BINARY_DIR}/Project/link_depends_no_shared_lib.h "#define link_depends_no_shared_lib_value 0\n") +file(WRITE ${BuildDepends_BINARY_DIR}/Project/object_depends.txt "1\n") + if(TEST_LINK_DEPENDS) file(WRITE ${TEST_LINK_DEPENDS} "2") endif() @@ -359,6 +364,20 @@ else() "Targets link_depends_no_shared_lib and link_depends_no_shared_exe not both built.") endif() +if(EXISTS "${object_depends_check_txt}") + file(STRINGS "${object_depends_check_txt}" object_depends_check LIMIT_COUNT 1) + if("${object_depends_check}" STREQUAL "1") + message(STATUS "object_depends exe is newer than object_depends.txt as expected.") + elseif(CMAKE_GENERATOR MATCHES "Visual Studio|Xcode") + message(STATUS "Known limitation: OBJECT_DEPENDS does not work on ${CMAKE_GENERATOR}") + else() + message(SEND_ERROR "Project did not rebuild properly: object_depends exe is not newer than object_depends.txt.") + endif() +else() + message(SEND_ERROR "Project did not rebuild properly. " + "object_depends exe and object_depends.txt are not both present.") +endif() + if(EXISTS ${BuildDepends_BINARY_DIR}/Project/external.out) file(STRINGS ${BuildDepends_BINARY_DIR}/Project/external.out external_out) if("${external_out}" STREQUAL "external changed") |