Allow use of the system's SQLite3 library.
Keep distro packagers happy by having the option to use the system's sqlite library instead of our bundled version. Set SYSTEM_SQLITE=1 when running cmake to use the system one.
This commit is contained in:
parent
9b900e9430
commit
50c61b4211
5 changed files with 56 additions and 2 deletions
|
@ -105,6 +105,7 @@ option(EVENT_INPUT "Set to ON to build FlightGear with event-based Input s
|
||||||
option(ENABLE_LIBSVN "Set to ON to build FlightGear/terrasync with libsvnclient support (default)" ON)
|
option(ENABLE_LIBSVN "Set to ON to build FlightGear/terrasync with libsvnclient support (default)" ON)
|
||||||
option(ENABLE_RTI "Set to ON to build FlightGear with RTI support" OFF)
|
option(ENABLE_RTI "Set to ON to build FlightGear with RTI support" OFF)
|
||||||
option(JPEG_FACTORY "Set to ON to build FlightGear with JPEG-factory support" OFF)
|
option(JPEG_FACTORY "Set to ON to build FlightGear with JPEG-factory support" OFF)
|
||||||
|
option(SYSTEM_SQLITE "Set to ON to build FlightGear with the system's SQLite3 library" OFF)
|
||||||
|
|
||||||
# additional utilities
|
# additional utilities
|
||||||
option(ENABLE_FGADMIN "Set to ON to build the FGADMIN application (default)" ON)
|
option(ENABLE_FGADMIN "Set to ON to build the FGADMIN application (default)" ON)
|
||||||
|
@ -182,6 +183,12 @@ if(ENABLE_LIBSVN)
|
||||||
endif(LIBSVN_FOUND)
|
endif(LIBSVN_FOUND)
|
||||||
endif(ENABLE_LIBSVN)
|
endif(ENABLE_LIBSVN)
|
||||||
|
|
||||||
|
if (SYSTEM_SQLITE)
|
||||||
|
find_package(SQLite3 REQUIRED)
|
||||||
|
set(CMAKE_REQUIRED_INCLUDES ${SQLITE3_INCLUDED_DIR})
|
||||||
|
message(STATUS "Using system SQLite3 library")
|
||||||
|
endif (SYSTEM_SQLITE)
|
||||||
|
|
||||||
find_package(PLIB REQUIRED puaux pu js fnt)
|
find_package(PLIB REQUIRED puaux pu js fnt)
|
||||||
|
|
||||||
# FlightGear and SimGear versions need to match
|
# FlightGear and SimGear versions need to match
|
||||||
|
|
41
CMakeModules/FindSQLite3.cmake
Normal file
41
CMakeModules/FindSQLite3.cmake
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
# Find Sqlite3
|
||||||
|
# ~~~~~~~~~~~~
|
||||||
|
# Copyright (c) 2007, Martin Dobias <wonder.sk at gmail.com>
|
||||||
|
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||||
|
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||||
|
#
|
||||||
|
# CMake module to search for Sqlite3 library
|
||||||
|
#
|
||||||
|
# If it's found it sets SQLITE3_FOUND to TRUE
|
||||||
|
# and following variables are set:
|
||||||
|
# SQLITE3_INCLUDE_DIR
|
||||||
|
# SQLITE3_LIBRARY
|
||||||
|
|
||||||
|
|
||||||
|
# FIND_PATH and FIND_LIBRARY normally search standard locations
|
||||||
|
# before the specified paths. To search non-standard paths first,
|
||||||
|
# FIND_* is invoked first with specified paths and NO_DEFAULT_PATH
|
||||||
|
# and then again with no specified paths to search the default
|
||||||
|
# locations. When an earlier FIND_* succeeds, subsequent FIND_*s
|
||||||
|
# searching for the same item do nothing.
|
||||||
|
|
||||||
|
FIND_PATH(SQLITE3_INCLUDE_DIR sqlite3.h
|
||||||
|
PATH_SUFFIXES include
|
||||||
|
HINTS $ENV{SQLITE3DIR}
|
||||||
|
PATHS
|
||||||
|
/usr/local
|
||||||
|
/usr
|
||||||
|
/opt/local
|
||||||
|
)
|
||||||
|
|
||||||
|
FIND_LIBRARY(SQLITE3_LIBRARY NAMES sqlite3 sqlite3
|
||||||
|
HINTS $ENV{SQLITE3DIR}
|
||||||
|
PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64
|
||||||
|
PATHS
|
||||||
|
/usr/local
|
||||||
|
/usr
|
||||||
|
/opt/local
|
||||||
|
)
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SQLITE3 DEFAULT_MSG SQLITE3_LIBRARY SQLITE3_INCLUDE_DIR)
|
|
@ -37,3 +37,5 @@
|
||||||
|
|
||||||
#cmakedefine FG_HAVE_HLA
|
#cmakedefine FG_HAVE_HLA
|
||||||
#cmakedefine FG_JPEG_SERVER
|
#cmakedefine FG_JPEG_SERVER
|
||||||
|
|
||||||
|
#cmakedefine SYSTEM_SQLITE
|
||||||
|
|
|
@ -98,6 +98,7 @@ target_link_libraries(fgfs
|
||||||
${PLIB_LIBRARIES}
|
${PLIB_LIBRARIES}
|
||||||
${JPEG_LIBRARY}
|
${JPEG_LIBRARY}
|
||||||
${HLA_LIBRARIES}
|
${HLA_LIBRARIES}
|
||||||
|
${SQLITE3_LIBRARY}
|
||||||
${EVENT_INPUT_LIBRARIES}
|
${EVENT_INPUT_LIBRARIES}
|
||||||
${SIMGEAR_CORE_LIBRARY_DEPENDENCIES}
|
${SIMGEAR_CORE_LIBRARY_DEPENDENCIES}
|
||||||
${SIMGEAR_SCENE_LIBRARY_DEPENDENCIES}
|
${SIMGEAR_SCENE_LIBRARY_DEPENDENCIES}
|
||||||
|
|
|
@ -15,7 +15,6 @@ set(SOURCES
|
||||||
LevelDXML.cxx
|
LevelDXML.cxx
|
||||||
FlightPlan.cxx
|
FlightPlan.cxx
|
||||||
NavDataCache.cxx
|
NavDataCache.cxx
|
||||||
sqlite3.c
|
|
||||||
PositionedOctree.cxx
|
PositionedOctree.cxx
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -34,8 +33,12 @@ set(HEADERS
|
||||||
LevelDXML.hxx
|
LevelDXML.hxx
|
||||||
FlightPlan.hxx
|
FlightPlan.hxx
|
||||||
NavDataCache.hxx
|
NavDataCache.hxx
|
||||||
sqlite3.h
|
|
||||||
PositionedOctree.hxx
|
PositionedOctree.hxx
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (NOT SYSTEM_SQLITE)
|
||||||
|
list(APPEND SOURCES sqlite3.c)
|
||||||
|
list(APPEND HEADERS sqlite3.h)
|
||||||
|
endif()
|
||||||
|
|
||||||
flightgear_component(Navaids "${SOURCES}" "${HEADERS}")
|
flightgear_component(Navaids "${SOURCES}" "${HEADERS}")
|
Loading…
Add table
Reference in a new issue