diff --git a/CMakeLists.txt b/CMakeLists.txt index 45564fa212..405abc5e32 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,6 +31,36 @@ add_definitions(-DORCT2_RESOURCE_DIR="${ORCT2_RESOURCE_DIR}") add_definitions(-DHAVE_CONFIG_H) add_definitions(-DCURL_STATICLIB) +# Define current git branch. +execute_process( + COMMAND git rev-parse --abbrev-ref HEAD + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE OPENRCT2_BRANCH + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET +) +add_definitions(-DOPENRCT2_BRANCH="${OPENRCT2_BRANCH}") + +# Define commit hash. +execute_process( + COMMAND git rev-parse HEAD + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE OPENRCT2_COMMIT_SHA1 + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET +) +add_definitions(-DOPENRCT2_COMMIT_SHA1="${OPENRCT2_COMMIT_SHA1}") + +# Define short commit hash. +execute_process( + COMMAND git rev-parse --short HEAD + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE OPENRCT2_COMMIT_SHA1_SHORT + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET +) +add_definitions(-DOPENRCT2_COMMIT_SHA1_SHORT="${OPENRCT2_COMMIT_SHA1_SHORT}") + INCLUDE(FindPkgConfig) # Options