1
0
Fork 0

Update FindSimGear.cmake module

Bring in-line with the current version from FG.
This commit is contained in:
James Turner 2012-09-16 16:15:16 +01:00
parent ccfde6914a
commit fe7899c018

View file

@ -75,13 +75,6 @@ macro(find_sg_library libName varName libs)
endif()
endmacro()
macro(find_sg_component comp libs)
set(compLib "sg${comp}")
string(TOUPPER "SIMGEAR_${comp}" libVar)
find_sg_library(${compLib} ${libVar} ${libs})
endmacro()
FIND_PATH(SIMGEAR_INCLUDE_DIR simgear/math/SGMath.hxx
HINTS $ENV{SIMGEAR_DIR}
PATH_SUFFIXES include
@ -102,17 +95,26 @@ endif()
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
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! "
"SimGear installation is incomplete.")
"SimGear installation is incomplete or mismatching.")
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 at least ${SimGear_FIND_VERSION})")
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()
message(STATUS "found SimGear version: ${SIMGEAR_VERSION} (needed ${SimGear_FIND_VERSION})")
if(NOT ${SIMGEAR_VERSION} GREATER ${SimGear_FIND_VERSION})
message(FATAL_ERROR "You have installed a mismatching SimGear version ${SIMGEAR_VERSION} "
@ -144,45 +146,11 @@ else(SIMGEAR_SHARED)
set(SIMGEAR_CORE_LIBRARIES "") # clear value
message(STATUS "looking for static SimGear libraries")
# note the order here affects the order Simgear libraries are
# linked in, and hence ability to link when using a traditional
# linker such as GNU ld on Linux
set(comps
nasal
timing
io
bucket
serial
math
structure
props
xml
misc
threads
debug
magvar
)
set(scene_comps
ephem
sky
material
tgdb
model
screen)
foreach(component ${comps})
find_sg_component(${component} SIMGEAR_CORE_LIBRARIES)
endforeach()
foreach(component ${scene_comps})
find_sg_component(${component} SIMGEAR_LIBRARIES)
endforeach()
find_sg_library(SimGearCore SIMGEAR_CORE SIMGEAR_CORE_LIBRARIES)
find_sg_library(SimgearScene SIMGEAR_SCENE SIMGEAR_LIBRARIES)
# again link order matters - scene libraries depend on core ones
list(APPEND SIMGEAR_LIBRARIES ${SIMGEAR_CORE_LIBRARIES})
#message(STATUS "all libs ${SIMGEAR_LIBRARIES}")
set(SIMGEAR_CORE_LIBRARY_DEPENDENCIES
${CMAKE_THREAD_LIBS_INIT}
@ -203,7 +171,7 @@ endif(SIMGEAR_SHARED)
if((NOT SIMGEAR_CORE_LIBRARIES)OR(NOT SIMGEAR_LIBRARIES))
message(FATAL_ERROR "Cannot find SimGear libraries! (Forgot 'make install' for SimGear?) "
"Compile & INSTALL SimGear before configuring FlightGear. "
"Compile & INSTALL SimGear before configuring TerraGear. "
"When using non-standard locations, use 'SIMGEAR_DIR' to configure the SimGear location.")
else()
message(STATUS "found SimGear libraries")