diff options
author | Chris Robinson <[email protected]> | 2016-12-21 01:08:33 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2016-12-21 01:12:47 -0800 |
commit | bcb6dfee71ef0ce4a0b9e7ceccb943f7f28704c4 (patch) | |
tree | e06b805f989c34613ab1980aa0d2a9dc976b215d /CMakeLists.txt | |
parent | 8f581c0e66e52a6f24e85763b39ed3be29a3e792 (diff) |
Trace the commit ID and branch the library was built from
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 34e55377..e1e9a851 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1174,6 +1174,25 @@ IF(LIBTYPE STREQUAL "STATIC") SET(PKG_CONFIG_CFLAGS -DAL_LIBTYPE_STATIC ${PKG_CONFIG_CFLAGS}) ENDIF() +IF(EXISTS "${OpenAL_SOURCE_DIR}/.git") + # Get the current working branch and its latest abbreviated commit hash + EXECUTE_PROCESS( + COMMAND git rev-parse --abbrev-ref HEAD + WORKING_DIRECTORY "${OpenAL_SOURCE_DIR}" + OUTPUT_VARIABLE GIT_BRANCH + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + EXECUTE_PROCESS( + COMMAND git log -1 --format=%h + WORKING_DIRECTORY "${OpenAL_SOURCE_DIR}" + OUTPUT_VARIABLE GIT_COMMIT_HASH + OUTPUT_STRIP_TRAILING_WHITESPACE + ) +ELSE() + SET(GIT_BRANCH "UNKNOWN") + SET(GIT_COMMIT_HASH "unknown") +ENDIF() + # Needed for openal.pc.in SET(prefix ${CMAKE_INSTALL_PREFIX}) SET(exec_prefix "\${prefix}") @@ -1184,6 +1203,9 @@ SET(PACKAGE_VERSION "${LIB_VERSION}") # End configuration CONFIGURE_FILE( + "${OpenAL_SOURCE_DIR}/version.h.in" + "${OpenAL_BINARY_DIR}/version.h") +CONFIGURE_FILE( "${OpenAL_SOURCE_DIR}/config.h.in" "${OpenAL_BINARY_DIR}/config.h") CONFIGURE_FILE( |