Improve error message when SimGear headers are missing/incomplete.
Also avoid CMake errors when files are missing.
This commit is contained in:
parent
f001c5f9fe
commit
7a0db802d2
2 changed files with 33 additions and 18 deletions
|
@ -37,7 +37,10 @@ set(CMAKE_MINSIZEREL_POSTFIX "" CACHE STRING "add a postfix, usually empty
|
||||||
|
|
||||||
# read 'version' file into a variable (stripping any newlines or spaces)
|
# read 'version' file into a variable (stripping any newlines or spaces)
|
||||||
file(READ version versionFile)
|
file(READ version versionFile)
|
||||||
string(STRIP ${versionFile} FLIGHTGEAR_VERSION)
|
if (NOT versionFile)
|
||||||
|
message(FATAL_ERROR "Unable to determine FlightGear version. Version file is missing.")
|
||||||
|
endif()
|
||||||
|
string(STRIP "${versionFile}" FLIGHTGEAR_VERSION)
|
||||||
|
|
||||||
# FlightGear packaging (to build a source tarball)
|
# FlightGear packaging (to build a source tarball)
|
||||||
include( ConfigureCPack )
|
include( ConfigureCPack )
|
||||||
|
@ -60,7 +63,7 @@ endif(NOT CMAKE_BUILD_TYPE)
|
||||||
if(NOT "$ENV{BUILD_ID}" STREQUAL "")
|
if(NOT "$ENV{BUILD_ID}" STREQUAL "")
|
||||||
set(HUDSON_BUILD_ID $ENV{BUILD_ID})
|
set(HUDSON_BUILD_ID $ENV{BUILD_ID})
|
||||||
set(HUDSON_BUILD_NUMBER $ENV{BUILD_NUMBER})
|
set(HUDSON_BUILD_NUMBER $ENV{BUILD_NUMBER})
|
||||||
message(STATUS "running under Hudson, build-number is ${HUDSON_BUILD_NUMBER}")
|
message(STATUS "running under Hudson/Jenkins, build-number is ${HUDSON_BUILD_NUMBER}")
|
||||||
else()
|
else()
|
||||||
set(HUDSON_BUILD_NUMBER 0)
|
set(HUDSON_BUILD_NUMBER 0)
|
||||||
set(HUDSON_BUILD_ID "none")
|
set(HUDSON_BUILD_ID "none")
|
||||||
|
@ -91,19 +94,22 @@ else()
|
||||||
set(REVISION "none")
|
set(REVISION "none")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
option(LOGGING "Set to OFF to build FlightGear without logging" ON)
|
# FlightGear build options
|
||||||
|
option(LOGGING "Set to ON to build FlightGear with logging support (default)" ON)
|
||||||
option(SP_FDMS "Set to ON to build FlightGear with special-purpose FDMs" OFF)
|
option(SP_FDMS "Set to ON to build FlightGear with special-purpose FDMs" OFF)
|
||||||
option(ENABLE_UIUC_MODEL "Set to ON to build FlightGear with UIUCModel FDM" OFF)
|
option(ENABLE_UIUC_MODEL "Set to ON to build FlightGear with UIUCModel FDM" OFF)
|
||||||
option(ENABLE_LARCSIM "Set to ON to build FlightGear with LaRCsim FDM" OFF)
|
option(ENABLE_LARCSIM "Set to ON to build FlightGear with LaRCsim FDM" OFF)
|
||||||
option(ENABLE_YASIM "Set to ON to build FlightGear with YASIM FDM" ON)
|
option(ENABLE_YASIM "Set to ON to build FlightGear with YASIM FDM (default)" ON)
|
||||||
option(ENABLE_JSBSIM "Set to ON to build FlightGear with JSBSim FDM" ON)
|
option(ENABLE_JSBSIM "Set to ON to build FlightGear with JSBSim FDM (default)" ON)
|
||||||
option(ENABLE_FGADMIN "Set to ON to build FlightGear with FGADMIN" ON)
|
|
||||||
option(EVENT_INPUT "Set to ON to build FlightGear with event-based Input support" ${EVENT_INPUT_DEFAULT})
|
option(EVENT_INPUT "Set to ON to build FlightGear with event-based Input support" ${EVENT_INPUT_DEFAULT})
|
||||||
option(ENABLE_LIBSVN "Set to ON to build FlightGear/terrasync with libsvnclient support" ON)
|
option(ENABLE_LIBSVN "Set to ON to build FlightGear/terrasync with libsvnclient support (default)" ON)
|
||||||
option(ENABLE_RTI "Set to ON to build SimGear with RTI support" OFF)
|
option(ENABLE_RTI "Set to ON to build FlightGear with RTI support" OFF)
|
||||||
option(WITH_FGPANEL "Set to ON to build the fgpanel application" ON)
|
option(JPEG_FACTORY "Set to ON to build FlightGear with JPEG-factory support" OFF)
|
||||||
option(JPEG_FACTORY "Enable JPEG-factory support" OFF)
|
|
||||||
option(ENABLE_TESTS "Set to OFF to disable building test applications" ON)
|
# additional utilities
|
||||||
|
option(ENABLE_FGADMIN "Set to ON to build the FGADMIN application (default)" ON)
|
||||||
|
option(WITH_FGPANEL "Set to ON to build the fgpanel application (default)" ON)
|
||||||
|
option(ENABLE_TESTS "Set to ON to build test applications (default)" ON)
|
||||||
|
|
||||||
if(LOGGING)
|
if(LOGGING)
|
||||||
# nothing
|
# nothing
|
||||||
|
|
|
@ -102,19 +102,28 @@ endif()
|
||||||
|
|
||||||
message(STATUS "SimGear include directory: ${SIMGEAR_INCLUDE_DIR}")
|
message(STATUS "SimGear include directory: ${SIMGEAR_INCLUDE_DIR}")
|
||||||
|
|
||||||
|
# read the simgear version header file, get the version
|
||||||
|
file(READ ${SIMGEAR_INCLUDE_DIR}/simgear/version.h SG_VERSION_FILE)
|
||||||
|
|
||||||
# make sure the simgear/version.h header exists
|
# make sure the simgear/version.h header exists
|
||||||
if (NOT EXISTS ${SIMGEAR_INCLUDE_DIR}/simgear/version.h)
|
if (NOT SG_VERSION_FILE)
|
||||||
message(FATAL_ERROR "Found SimGear, but it does not contain a simgear/version.h include! "
|
message(FATAL_ERROR "Found SimGear, but it does not contain a simgear/version.h include! "
|
||||||
"SimGear installation is incomplete.")
|
"SimGear installation is incomplete or mismatching.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
string(STRIP "${SG_VERSION_FILE}" SIMGEAR_DEFINE)
|
||||||
|
string(REPLACE "#define SIMGEAR_VERSION " "" SIMGEAR_VERSION "${SIMGEAR_DEFINE}")
|
||||||
|
|
||||||
|
if(NOT SIMGEAR_VERSION)
|
||||||
|
message(FATAL_ERROR "Unable to find SimGear or simgear/version.h does not exist/is invalid. "
|
||||||
|
"Make sure you have installed the SimGear ${SimGear_FIND_VERSION} includes. "
|
||||||
|
"When using non-standard locations, please use 'SIMGEAR_DIR' "
|
||||||
|
"to select the SimGear library location to be used.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# read the simgear version header file, get the version
|
|
||||||
file(READ ${SIMGEAR_INCLUDE_DIR}/simgear/version.h sgVersionFile)
|
|
||||||
string(STRIP ${sgVersionFile} SIMGEAR_DEFINE)
|
|
||||||
string(REPLACE "#define SIMGEAR_VERSION " "" SIMGEAR_VERSION ${SIMGEAR_DEFINE})
|
|
||||||
message(STATUS "found SimGear version: ${SIMGEAR_VERSION} (needed ${SimGear_FIND_VERSION})")
|
message(STATUS "found SimGear version: ${SIMGEAR_VERSION} (needed ${SimGear_FIND_VERSION})")
|
||||||
|
|
||||||
if(NOT ${SIMGEAR_VERSION} EQUAL ${SimGear_FIND_VERSION})
|
if(NOT "${SIMGEAR_VERSION}" EQUAL "${SimGear_FIND_VERSION}")
|
||||||
message(FATAL_ERROR "You have installed a mismatching SimGear version ${SIMGEAR_VERSION} "
|
message(FATAL_ERROR "You have installed a mismatching SimGear version ${SIMGEAR_VERSION} "
|
||||||
"instead of ${SimGear_FIND_VERSION} as required by FlightGear. "
|
"instead of ${SimGear_FIND_VERSION} as required by FlightGear. "
|
||||||
"When using multiple SimGear installations, please use 'SIMGEAR_DIR' "
|
"When using multiple SimGear installations, please use 'SIMGEAR_DIR' "
|
||||||
|
|
Loading…
Reference in a new issue