From a93deafa9c460aceb9ca87add52405e1f41cf14a Mon Sep 17 00:00:00 2001 From: albert-github Date: Fri, 15 May 2020 13:47:20 +0200 Subject: Change of git version input file was not taken into account Changes in the git version input file file were not taken into account. Explicitly checking whether or not the input file is newer or not than the output file. --- cmake/git_watcher.cmake | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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) -- cgit v0.12