1
0
Fork 0
flightgear/CMakeModules/GenerateBuildInfo.cmake
James Turner 016e1c89bc CMake: avoid invoking Git in Dev builds
Avoid running FindGit and git process on every build, when in Developer
mode: this feature is only useful for CI builds, and remove it makes
the edit-and-debug cycle slightly faster. This means buildId.h contains
dummy values when FG_BUILD_TYPE=Dev
2023-01-09 15:07:03 +00:00

24 lines
819 B
CMake

set(BUILD_ID_DST_PATH "${CMAKE_BINARY_DIR}/src/Include/flightgearBuildId.h")
if (FG_BUILD_TYPE STREQUAL "Dev")
# default values for all of these
set(JENKINS_BUILD_ID "none")
set(JENKINS_BUILD_NUMBER 0)
set(REVISION "none")
# generate a placeholder buildId header
configure_file (${CMAKE_SOURCE_DIR}/src/Include/flightgearBuildId.h.cmake-in ${BUILD_ID_DST_PATH})
# dummy target, does nothing
add_custom_target(buildId)
else()
# for non-Dev builds, run this each time. using some CMake in script mode
# this takes a little bit of time since we have to actually run Git as a sub-process
add_custom_target(
buildId
${CMAKE_COMMAND} -D SRC=${CMAKE_SOURCE_DIR}
-D DST=${BUILD_ID_DST_PATH}
-P ${CMAKE_SOURCE_DIR}/CMakeModules/buildId.cmake
)
endif()