1
0
Fork 0
flightgear/CMakeModules/buildId.cmake
James Turner 3f5a0a47ad Improved build.h generation (each build)
Use a custom_target to recursively invoke Cmake at build time; this
ensures the build ID and Git revision are always up to date.
2018-08-19 16:06:16 +01:00

20 lines
No EOL
611 B
CMake

if(NOT "$ENV{BUILD_ID}" STREQUAL "")
set(JENKINS_BUILD_ID $ENV{BUILD_ID})
set(JENKINS_BUILD_NUMBER $ENV{BUILD_NUMBER})
message(STATUS "running under Jenkins, build-number is ${JENKINS_BUILD_NUMBER}")
else()
set(JENKINS_BUILD_NUMBER 0)
set(JENKINS_BUILD_ID "none")
endif()
find_package(Git)
if (GIT_FOUND)
execute_process(COMMAND git --git-dir ${SRC}/.git rev-parse HEAD
OUTPUT_VARIABLE REVISION
OUTPUT_STRIP_TRAILING_WHITESPACE)
message(STATUS "Git revision is ${REVISION}")
else()
set(REVISION "none")
endif()
configure_file (${SRC}/src/Include/build.h.cmake-in ${DST})