diff options
author | Shauren <shauren.trinity@gmail.com> | 2015-02-22 20:51:25 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2015-02-22 20:51:25 +0100 |
commit | 4669f94018fc82df6d70b35847849d13e5224f6b (patch) | |
tree | 3fa6d61739d221b8ac36effbb97ad38d88156b7e | |
parent | e81eb1192a159627d06946a8ed84174e8ead7299 (diff) |
Buildsystem/Genrev: Fixed revision generator not reading existing cmake cache variables
-rw-r--r-- | cmake/genrev.cmake | 16 | ||||
-rw-r--r-- | src/genrev/CMakeLists.txt | 4 |
2 files changed, 9 insertions, 11 deletions
diff --git a/cmake/genrev.cmake b/cmake/genrev.cmake index c34e9d75973..1f5f02ceeec 100644 --- a/cmake/genrev.cmake +++ b/cmake/genrev.cmake @@ -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" diff --git a/src/genrev/CMakeLists.txt b/src/genrev/CMakeLists.txt index 8ab3494cd70..e72643c6a6b 100644 --- a/src/genrev/CMakeLists.txt +++ b/src/genrev/CMakeLists.txt @@ -10,6 +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} -DNO_GIT=${WITHOUT_GIT} -DGIT_EXEC=${GIT_EXECUTABLE} -DBUILDDIR=${CMAKE_BINARY_DIR} -P ${CMAKE_SOURCE_DIR}/cmake/genrev.cmake - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + COMMAND "${CMAKE_COMMAND}" -DBUILDDIR="${CMAKE_BINARY_DIR}" -P "${CMAKE_SOURCE_DIR}/cmake/genrev.cmake" "${CMAKE_BINARY_DIR}" + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" ) |