summaryrefslogtreecommitdiffstats
path: root/Tests/BuildDepends/Project
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-07-22 15:15:20 (GMT)
committerBrad King <brad.king@kitware.com>2015-07-22 15:37:47 (GMT)
commit783c375766b1e5656dd34dd99281fceb7ed7aab2 (patch)
tree1c1d9074ea0f3e9aac7d306f68f2cc47e155f80e /Tests/BuildDepends/Project
parente00e8713de13570b8ca41291c0a863a8be00686c (diff)
downloadCMake-783c375766b1e5656dd34dd99281fceb7ed7aab2.zip
CMake-783c375766b1e5656dd34dd99281fceb7ed7aab2.tar.gz
CMake-783c375766b1e5656dd34dd99281fceb7ed7aab2.tar.bz2
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/Project')
-rw-r--r--Tests/BuildDepends/Project/CMakeLists.txt12
-rw-r--r--Tests/BuildDepends/Project/object_depends.cxx1
-rw-r--r--Tests/BuildDepends/Project/object_depends_check.cmake7
3 files changed, 20 insertions, 0 deletions
diff --git a/Tests/BuildDepends/Project/CMakeLists.txt b/Tests/BuildDepends/Project/CMakeLists.txt
index 0db39c5..3aa57fc 100644
--- a/Tests/BuildDepends/Project/CMakeLists.txt
+++ b/Tests/BuildDepends/Project/CMakeLists.txt
@@ -182,3 +182,15 @@ if(TEST_MULTI3)
set_property(SOURCE multi3-real.txt multi3-dummy.txt PROPERTY SYMBOLIC 1)
add_custom_target(multi3 ALL DEPENDS multi3-real.txt)
endif()
+
+add_executable(object_depends object_depends.cxx)
+set_property(SOURCE object_depends.cxx PROPERTY OBJECT_DEPENDS
+ ${CMAKE_CURRENT_BINARY_DIR}/object_depends.txt)
+add_custom_target(object_depends_check ALL
+ COMMAND ${CMAKE_COMMAND}
+ -Dexe=$<TARGET_FILE:object_depends>
+ -Dout=${CMAKE_CURRENT_BINARY_DIR}/object_depends_check.txt
+ -Dtxt=${CMAKE_CURRENT_BINARY_DIR}/object_depends.txt
+ -P ${CMAKE_CURRENT_SOURCE_DIR}/object_depends_check.cmake
+ )
+add_dependencies(object_depends_check object_depends)
diff --git a/Tests/BuildDepends/Project/object_depends.cxx b/Tests/BuildDepends/Project/object_depends.cxx
new file mode 100644
index 0000000..76e8197
--- /dev/null
+++ b/Tests/BuildDepends/Project/object_depends.cxx
@@ -0,0 +1 @@
+int main() { return 0; }
diff --git a/Tests/BuildDepends/Project/object_depends_check.cmake b/Tests/BuildDepends/Project/object_depends_check.cmake
new file mode 100644
index 0000000..e009892
--- /dev/null
+++ b/Tests/BuildDepends/Project/object_depends_check.cmake
@@ -0,0 +1,7 @@
+if(NOT EXISTS "${txt}" OR NOT EXISTS "${exe}")
+ file(REMOVE "${out}")
+elseif("${exe}" IS_NEWER_THAN "${txt}")
+ file(WRITE "${out}" "1\n")
+else()
+ file(WRITE "${out}" "0\n")
+endif()