summaryrefslogtreecommitdiffstats
path: root/cmake/git_watcher.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/git_watcher.cmake')
-rw-r--r--cmake/git_watcher.cmake13
1 files changed, 13 insertions, 0 deletions
diff --git a/cmake/git_watcher.cmake b/cmake/git_watcher.cmake
index 72b7852..ac34c1d 100644
--- a/cmake/git_watcher.cmake
+++ b/cmake/git_watcher.cmake
@@ -150,6 +150,19 @@ function(CheckGit _working_dir _state_changed _state)
# (Passing by reference in CMake is awkward...)
set(${_state} ${state} PARENT_SCOPE)
+ if(EXISTS "${POST_CONFIGURE_GIT_VERSION_FILE}")
+ if("${PRE_CONFIGURE_GIT_VERSION_FILE}" IS_NEWER_THAN "${POST_CONFIGURE_GIT_VERSION_FILE}")
+ file(REMOVE "${POST_CONFIGURE_GIT_VERSION_FILE}")
+ file(REMOVE "${GIT_STATE_FILE}")
+ set(${_state_changed} "true" PARENT_SCOPE)
+ return()
+ endif()
+ else()
+ file(REMOVE "${GIT_STATE_FILE}")
+ set(${_state_changed} "true" PARENT_SCOPE)
+ return()
+ endif()
+
# Check if the state has changed compared to the backup on disk.
if(EXISTS "${GIT_STATE_FILE}")
file(READ "${GIT_STATE_FILE}" OLD_HEAD_CONTENTS)