Merge pull request #2162 from gongminmin/IgnoreHash

Add IGNORE_GIT_HASH.
pull/2161/head^2
Kim Kulling 2018-10-02 01:12:30 +02:00 committed by GitHub
commit 382f5fde5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 23 additions and 16 deletions

View File

@ -110,6 +110,11 @@ OPTION( INJECT_DEBUG_POSTFIX
ON ON
) )
OPTION ( IGNORE_GIT_HASH
"Don't call git to get the hash."
OFF
)
IF (IOS) IF (IOS)
IF (NOT CMAKE_BUILD_TYPE) IF (NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE "Release") SET(CMAKE_BUILD_TYPE "Release")
@ -153,23 +158,25 @@ SET( ASSIMP_PACKAGE_VERSION "0" CACHE STRING "the package-specific version used
# Enable C++1 globally # Enable C++1 globally
set_property( GLOBAL PROPERTY CXX_STANDARD 11 ) set_property( GLOBAL PROPERTY CXX_STANDARD 11 )
# Get the current working branch IF(NOT IGNORE_GIT_HASH)
EXECUTE_PROCESS( # Get the current working branch
EXECUTE_PROCESS(
COMMAND git rev-parse --abbrev-ref HEAD COMMAND git rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_BRANCH OUTPUT_VARIABLE GIT_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET ERROR_QUIET
) )
# Get the latest abbreviated commit hash of the working branch # Get the latest abbreviated commit hash of the working branch
EXECUTE_PROCESS( EXECUTE_PROCESS(
COMMAND git log -1 --format=%h --no-show-signature COMMAND git log -1 --format=%h --no-show-signature
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_HASH OUTPUT_VARIABLE GIT_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET ERROR_QUIET
) )
ENDIF()
IF(NOT GIT_COMMIT_HASH) IF(NOT GIT_COMMIT_HASH)
SET(GIT_COMMIT_HASH 0) SET(GIT_COMMIT_HASH 0)