1
0
Fork 0

version.h support in CMake builds.

This commit is contained in:
James Turner 2011-01-01 18:24:53 +00:00
parent d4d70200eb
commit 4d1d215ded
3 changed files with 36 additions and 1 deletions

View file

@ -20,6 +20,25 @@ set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/CMakeModules;${CMAKE_MODULE_PATH}")
# autoconf compatibility
set(PKGLIBDIR "foo")
if($ENV{BUILD_ID})
set(HUDSON_BUILD_ID $ENV{BUILD_ID})
set(HUDSON_BUILD_NUMBER $ENV{BUILD_NUMBER})
message(STATUS "running under Hudson, build-number is ${HUDSON_BUILD_NUMBER}")
else()
set(HUDSON_BUILD_NUMBER 0)
set(HUDSON_BUILD_ID "none")
endif()
find_package(Git)
if (GIT_FOUND)
execute_process(COMMAND git --git-dir ${PROJECT_SOURCE_DIR}/.git rev-parse HEAD
OUTPUT_VARIABLE REVISION
OUTPUT_STRIP_TRAILING_WHITESPACE)
message(STATUS "Git revision is ${REVISION}")
else()
set(REVISION "none")
endif()
option(LOGGING "Set to OFF to build FlightGear without logging" ON)
option(SP_FDMS "Set to ON to build FlightGear with special-purpose FDMs" OFF)
@ -156,7 +175,13 @@ configure_file (
"${PROJECT_SOURCE_DIR}/src/Include/config_cmake.h.in"
"${PROJECT_BINARY_DIR}/src/Include/config.h"
)
#and the same for the version header
configure_file (
"${PROJECT_SOURCE_DIR}/src/Include/version.h.cmake-in"
"${PROJECT_BINARY_DIR}/src/Include/version.h"
)
add_subdirectory(src)
add_subdirectory(utils)

View file

@ -21,6 +21,8 @@
#define VERSION "@FLIGHTGEAR_VERSION"
#define HAVE_VERSION_H 1 // version.h is assumed for CMake builds
#cmakedefine ENABLE_UIUC_MODEL
#cmakedefine ENABLE_LARCSIM
#cmakedefine ENABLE_YASIM

View file

@ -0,0 +1,8 @@
#cmakedefine FLIGHTGEAR_VERSION
#cmakedefine HUDSON_BUILD_NUMBER
#cmakedefine HUDSON_BUILD_ID
#cmakedefine REVISION