Locate git with find_package

develop
lethosor 2015-06-25 11:43:54 -04:00
parent ee7a2c7db7
commit 524593a3d3
3 changed files with 6 additions and 1 deletions

@ -143,6 +143,10 @@ include_directories(${ZLIB_INCLUDE_DIRS})
include_directories(depends/clsocket/src)
add_subdirectory(depends)
find_package(Git)
if(NOT GIT_FOUND)
message(FATAL_ERROR "could not find git")
endif()
#find_package(Docutils)

@ -260,6 +260,7 @@ SET_PROPERTY(TARGET dfhack-version APPEND PROPERTY COMPILE_DEFINITIONS
ADD_CUSTOM_TARGET(git-describe
COMMAND ${CMAKE_COMMAND}
-D dfhack_SOURCE_DIR:STRING=${dfhack_SOURCE_DIR}
-D GIT_EXECUTABLE:STRING=${GIT_EXECUTABLE}
-P ${CMAKE_CURRENT_SOURCE_DIR}/git-describe.cmake
COMMENT "Obtaining git commit information"
)

@ -1,4 +1,4 @@
execute_process(COMMAND git describe --tags
execute_process(COMMAND ${GIT_EXECUTABLE} describe --tags
WORKING_DIRECTORY "${dfhack_SOURCE_DIR}"
OUTPUT_VARIABLE DFHACK_GIT_DESCRIPTION)
string(STRIP ${DFHACK_GIT_DESCRIPTION} DFHACK_GIT_DESCRIPTION)