move get_git_hash definition to main CMakeLists.txt

This commit is contained in:
Hubert Jarosz
2016-08-10 13:00:59 +02:00
parent cf4ee8e861
commit 05bc395fd6
3 changed files with 15 additions and 16 deletions
+15
View File
@@ -9,6 +9,21 @@ if(CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR)
message(FATAL_ERROR "In-source builds not allowed")
endif()
function(get_git_hash _git_hash)
if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
execute_process(
COMMAND git rev-parse HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif()
if(NOT GIT_HASH)
set(GIT_HASH "NO_GIT_COMMIT_HASH_DEFINED")
endif()
set(${_git_hash} "${GIT_HASH}" PARENT_SCOPE)
endfunction(get_git_hash)
project(RenderDoc CXX C)
option(ENABLE_GL "Enable GL driver" ON)
-14
View File
@@ -1,14 +0,0 @@
function(get_git_hash _git_hash)
if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
execute_process(
COMMAND git rev-parse HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif()
if(NOT GIT_HASH)
set(GIT_HASH "NO_GIT_COMMIT_HASH_DEFINED")
endif()
set(${_git_hash} "${GIT_HASH}" PARENT_SCOPE)
endfunction(get_git_hash)
-2
View File
@@ -1,5 +1,3 @@
include("${CMAKE_SOURCE_DIR}/GetGitHash.cmake")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(RDOC_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})