cmake: update timestamp status
authorAlexander Alekhin <alexander.alekhin@intel.com>
Wed, 13 Dec 2017 12:16:03 +0000 (15:16 +0300)
committerAlexander Alekhin <alexander.alekhin@intel.com>
Wed, 13 Dec 2017 12:31:36 +0000 (15:31 +0300)
- avoid unnecessary rebuilding of OpenCV libraries
- use timestamp of the first launch of CMake
- to return to previous behavior use `-UOPENCV_TIMESTAMP` CMake option

CMakeLists.txt

index d7ad2ee..4cb9db9 100644 (file)
@@ -917,11 +917,15 @@ endif()
 # ========================== build platform ==========================
 status("")
 status("  Platform:")
-if(NOT CMAKE_VERSION VERSION_LESS 2.8.11 AND NOT BUILD_INFO_SKIP_TIMESTAMP)
-  string(TIMESTAMP TIMESTAMP "" UTC)
-  if(TIMESTAMP)
-    status("    Timestamp:"    ${TIMESTAMP})
-  endif()
+if(NOT DEFINED OPENCV_TIMESTAMP
+    AND NOT CMAKE_VERSION VERSION_LESS 2.8.11
+    AND NOT BUILD_INFO_SKIP_TIMESTAMP
+)
+  string(TIMESTAMP OPENCV_TIMESTAMP "" UTC)
+  set(OPENCV_TIMESTAMP "${OPENCV_TIMESTAMP}" CACHE STRING "Timestamp of OpenCV build configuration" FORCE)
+endif()
+if(OPENCV_TIMESTAMP)
+  status("    Timestamp:"      ${OPENCV_TIMESTAMP})
 endif()
 status("    Host:"             ${CMAKE_HOST_SYSTEM_NAME} ${CMAKE_HOST_SYSTEM_VERSION} ${CMAKE_HOST_SYSTEM_PROCESSOR})
 if(CMAKE_CROSSCOMPILING)