Skip to content

Commit

Permalink
Change of git version input file was not taken into account
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
albert-github committed May 15, 2020
1 parent fe16aed commit a93deaf
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions cmake/git_watcher.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit a93deaf

Please sign in to comment.