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
This commit is contained in:
parent
36df4c38de
commit
016e1c89bc
1 changed files with 22 additions and 6 deletions
|
@ -1,8 +1,24 @@
|
||||||
|
|
||||||
add_custom_target(
|
set(BUILD_ID_DST_PATH "${CMAKE_BINARY_DIR}/src/Include/flightgearBuildId.h")
|
||||||
buildId
|
|
||||||
${CMAKE_COMMAND} -D SRC=${CMAKE_SOURCE_DIR}
|
|
||||||
-D DST=${CMAKE_BINARY_DIR}/src/Include/flightgearBuildId.h
|
|
||||||
-P ${CMAKE_SOURCE_DIR}/CMakeModules/buildId.cmake
|
|
||||||
)
|
|
||||||
|
|
||||||
|
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()
|
||||||
|
|
Loading…
Reference in a new issue