Buildsystem/Genrev: Fixed revision generator not reading existing cmake cache variables

This commit is contained in:
Shauren authored and click committed 2015-02-24 18:51:46 +01:00
1 parent 2502c383ef
commit 869bc4e0f7
2 files changed
+9 -11

No files matched your search

+7 -9
View File
@@ -12,21 +12,19 @@
# This is done EACH compile so they can be alerted about the consequences.
if(NOT BUILDDIR)
# Workaround for funny MSVC behaviour - this segment only run during compile
set(NO_GIT ${WITHOUT_GIT})
set(GIT_EXEC ${GIT_EXECUTABLE})
# Workaround for funny MSVC behaviour - this segment is only used when using cmake gui
set(BUILDDIR ${CMAKE_BINARY_DIR})
endif()
if(NO_GIT)
if(WITHOUT_GIT)
set(rev_date "1970-01-01 00:00:00 +0000")
set(rev_hash "unknown")
set(rev_branch "Archived")
else()
if(GIT_EXEC)
if(GIT_EXECUTABLE)
# Create a revision-string that we can use
execute_process(
COMMAND "${GIT_EXEC}" describe --match init --dirty=+ --abbrev=12
COMMAND "${GIT_EXECUTABLE}" describe --match init --dirty=+ --abbrev=12
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE rev_info
OUTPUT_STRIP_TRAILING_WHITESPACE
@@ -35,7 +33,7 @@ else()
# And grab the commits timestamp
execute_process(
COMMAND "${GIT_EXEC}" show -s --format=%ci
COMMAND "${GIT_EXECUTABLE}" show -s --format=%ci
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE rev_date
OUTPUT_STRIP_TRAILING_WHITESPACE
@@ -44,7 +42,7 @@ else()
# Also retrieve branch name
execute_process(
COMMAND "${GIT_EXEC}" rev-parse --abbrev-ref HEAD
COMMAND "${GIT_EXECUTABLE}" rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE rev_branch
OUTPUT_STRIP_TRAILING_WHITESPACE
@@ -69,7 +67,7 @@ else()
endif()
# Create the actual revision.h file from the above params
if(NOT "${rev_hash_cached}" MATCHES "${rev_hash}" OR NOT "${rev_branch_cached}" MATCHES "${rev_branch}")
if(NOT "${rev_hash_cached}" MATCHES "${rev_hash}" OR NOT "${rev_branch_cached}" MATCHES "${rev_branch}" OR NOT EXISTS "${BUILDDIR}/revision.h")
configure_file(
"${CMAKE_SOURCE_DIR}/revision.h.in.cmake"
"${BUILDDIR}/revision.h"