diff --git a/CMakeModules/GenerateBuildInfo.cmake b/CMakeModules/GenerateBuildInfo.cmake index 038a80670..78e831536 100644 --- a/CMakeModules/GenerateBuildInfo.cmake +++ b/CMakeModules/GenerateBuildInfo.cmake @@ -1,8 +1,24 @@ -add_custom_target( - buildId - ${CMAKE_COMMAND} -D SRC=${CMAKE_SOURCE_DIR} - -D DST=${CMAKE_BINARY_DIR}/src/Include/flightgearBuildId.h - -P ${CMAKE_SOURCE_DIR}/CMakeModules/buildId.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()