aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmake/genrev.cmake14
-rw-r--r--src/genrev/CMakeLists.txt1
2 files changed, 9 insertions, 6 deletions
diff --git a/cmake/genrev.cmake b/cmake/genrev.cmake
index 9fe49139717..29d95b4f8ff 100644
--- a/cmake/genrev.cmake
+++ b/cmake/genrev.cmake
@@ -62,8 +62,12 @@ if(NOT BUILDDIR)
endif()
# Create the actual revision.h file from the above params
-configure_file(
- "${CMAKE_SOURCE_DIR}/revision.h.in.cmake"
- "${BUILDDIR}/revision.h"
- @ONLY
-)
+
+if(NOT hg_rev_id MATCHES "${hg_rev_id_cached}")
+ configure_file(
+ "${CMAKE_SOURCE_DIR}/revision.h.in.cmake"
+ "${BUILDDIR}/revision.h"
+ @ONLY
+ )
+ set(hg_rev_id_cached ${hg_rev_id} CACHE TYPE STRING)
+endif()
diff --git a/src/genrev/CMakeLists.txt b/src/genrev/CMakeLists.txt
index bcc874fbd80..316ed5b8580 100644
--- a/src/genrev/CMakeLists.txt
+++ b/src/genrev/CMakeLists.txt
@@ -10,7 +10,6 @@
# Need to pass old ${CMAKE_BINARY_DIR} as param because its different at build stage
add_custom_target(revision.h ALL
- COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_BINARY_DIR}/revision.h
COMMAND ${CMAKE_COMMAND} -DBUILDDIR=${CMAKE_BINARY_DIR} -P ${CMAKE_SOURCE_DIR}/cmake/genrev.cmake
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)