summaryrefslogtreecommitdiffstats
path: root/Tests/CMakeTests/File-TIMESTAMP-NotBogus.cmake
diff options
context:
space:
mode:
authorNils Gladitz <gladitz@scivis.de>2012-10-05 19:55:07 (GMT)
committerDavid Cole <david.cole@kitware.com>2012-12-05 15:39:10 (GMT)
commit711e2b3b5c674d4f754b5b214d511be6ce7e8f4d (patch)
treeeac34a0d730f835f60e4fb28cc0e039c30298d3d /Tests/CMakeTests/File-TIMESTAMP-NotBogus.cmake
parent2bb2745fa8c260d12aca33d2e1fd26a92d3bfa6b (diff)
downloadCMake-711e2b3b5c674d4f754b5b214d511be6ce7e8f4d.zip
CMake-711e2b3b5c674d4f754b5b214d511be6ce7e8f4d.tar.gz
CMake-711e2b3b5c674d4f754b5b214d511be6ce7e8f4d.tar.bz2
CMake: Add TIMESTAMP subcommand to string and file commands
Diffstat (limited to 'Tests/CMakeTests/File-TIMESTAMP-NotBogus.cmake')
-rw-r--r--Tests/CMakeTests/File-TIMESTAMP-NotBogus.cmake24
1 files changed, 24 insertions, 0 deletions
diff --git a/Tests/CMakeTests/File-TIMESTAMP-NotBogus.cmake b/Tests/CMakeTests/File-TIMESTAMP-NotBogus.cmake
new file mode 100644
index 0000000..d0e5fe3
--- /dev/null
+++ b/Tests/CMakeTests/File-TIMESTAMP-NotBogus.cmake
@@ -0,0 +1,24 @@
+set(STAMP_FILENAME "${CMAKE_CURRENT_BINARY_DIR}/FileTimestamp-Stamp")
+set(STAMP_FORMAT "%Y-%m-%d")
+
+string(TIMESTAMP timestamp1 "${STAMP_FORMAT}")
+
+file(WRITE "${STAMP_FILENAME}" "foo")
+file(TIMESTAMP "${STAMP_FILENAME}" timestamp2 "${STAMP_FORMAT}")
+
+string(TIMESTAMP timestamp3 "${STAMP_FORMAT}")
+
+message(STATUS "timestamp1 [${timestamp1}]")
+message(STATUS "timestamp2 [${timestamp2}]")
+message(STATUS "timestamp3 [${timestamp3}]")
+
+if(timestamp1 STREQUAL timestamp3)
+ if(NOT timestamp1 STREQUAL timestamp2)
+ message(FATAL_ERROR
+ "timestamp mismatch [${timestamp1}] != [${timestamp2}]")
+ else()
+ message("all timestamps match")
+ endif()
+else()
+ message(WARNING "this test may race when run at midnight")
+endif()