mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-22 00:06:12 -05:00
Use CMake's SQLite targets
This uses the same targets and variables introduced in the FindSQLite3 module in CMake starting with version 3.14. The other CMakeFiles.txt are modified accordingly.
This commit is contained in:
parent
adc1224943
commit
c06c7c938e
@ -368,10 +368,11 @@ if(WITH_CORE)
|
||||
set (WITH_INTERNAL_NLOHMANN_JSON ON CACHE BOOL "Determines whether the vendored copy of nlohmann-json should be used")
|
||||
find_package(nlohmann_json REQUIRED)
|
||||
|
||||
find_package(Sqlite3)
|
||||
if (NOT SQLITE3_FOUND)
|
||||
message (SEND_ERROR "sqlite3 dependency was not found!")
|
||||
endif()
|
||||
# The following bypasses the FindSQLite3 module introduced in CMake 3.14
|
||||
# On case insensitive platforms (e.g. Windows) this is because
|
||||
# ./cmake/FindSqlite3.cmake comes first on the CMAKE_MODULE_PATH
|
||||
# (otherwise it is because of the case: *Sqlite3* vs. *SQLite3*)
|
||||
find_package(Sqlite3 REQUIRED)
|
||||
|
||||
find_package(Protobuf CONFIG)
|
||||
find_package(Protobuf REQUIRED)
|
||||
|
@ -11,13 +11,15 @@
|
||||
# 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.
|
||||
# We ensure consistency between the target defined by this file
|
||||
# and the official CMake's FindSQLite3.cmake
|
||||
# https://cmake.org/cmake/help/latest/module/FindSQLite3.html
|
||||
if(SQLITE3_FOUND)
|
||||
if(NOT SQLite3_FOUND OR NOT TARGET SQLite::SQLite3)
|
||||
message(FATAL_ERROR "Unconsistency between SQLite3 dependencies")
|
||||
endif()
|
||||
return()
|
||||
endif()
|
||||
|
||||
# try to use framework on mac
|
||||
# want clean framework path, not unix compatibility path
|
||||
@ -37,12 +39,6 @@ IF (APPLE AND NOT QGIS_MAC_DEPS_DIR)
|
||||
ENDIF ()
|
||||
ENDIF (APPLE AND NOT QGIS_MAC_DEPS_DIR)
|
||||
|
||||
# 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
|
||||
"$ENV{LIB_DIR}/include"
|
||||
"$ENV{LIB_DIR}/include/sqlite"
|
||||
@ -74,3 +70,18 @@ ELSE (SQLITE3_FOUND)
|
||||
ENDIF (SQLITE3_FIND_REQUIRED)
|
||||
|
||||
ENDIF (SQLITE3_FOUND)
|
||||
|
||||
# Create the imported target following the official CMake's FindSQLite3.cmake
|
||||
if(SQLITE3_FOUND)
|
||||
set(SQLite3_FOUND TRUE)
|
||||
set(SQLite3_INCLUDE_DIRS ${SQLITE3_INCLUDE_DIR})
|
||||
set(SQLite3_LIBRARIES ${SQLITE3_LIBRARY})
|
||||
if(NOT TARGET SQLite::SQLite3)
|
||||
add_library(SQLite::SQLite3 UNKNOWN IMPORTED)
|
||||
set_target_properties(SQLite::SQLite3 PROPERTIES
|
||||
IMPORTED_LOCATION "${SQLITE3_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${SQLITE3_INCLUDE_DIR}")
|
||||
else()
|
||||
message(FATAL_ERROR "SQLite::SQLite3 target should not have been defined at this point.")
|
||||
endif()
|
||||
endif()
|
||||
|
5
external/qspatialite/CMakeLists.txt
vendored
5
external/qspatialite/CMakeLists.txt
vendored
@ -5,10 +5,7 @@ add_definitions(${QT_DEFINITIONS})
|
||||
add_definitions(-DQT_PLUGIN)
|
||||
add_definitions(-DQT_SHARED)
|
||||
|
||||
include_directories(SYSTEM
|
||||
${SQLITE3_INCLUDE_DIR}
|
||||
${${QT_VERSION_BASE}Sql_PRIVATE_INCLUDE_DIRS}
|
||||
)
|
||||
include_directories(SYSTEM ${${QT_VERSION_BASE}Sql_PRIVATE_INCLUDE_DIRS})
|
||||
|
||||
set(QSQLSPATIALITE_SRC qsql_spatialite.cpp smain.cpp qsql_spatialite.h smain.h)
|
||||
|
||||
|
@ -77,7 +77,6 @@ include_directories(SYSTEM
|
||||
${QWT_INCLUDE_DIR}
|
||||
${QCA_INCLUDE_DIR}
|
||||
${QTKEYCHAIN_INCLUDE_DIR}
|
||||
${SQLITE3_INCLUDE_DIR}
|
||||
${SPATIALINDEX_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
|
@ -471,7 +471,6 @@ if (WITH_PDAL AND PDAL_2_5_OR_HIGHER)
|
||||
endif()
|
||||
|
||||
include_directories(SYSTEM ${SPATIALINDEX_INCLUDE_DIR})
|
||||
include_directories(SYSTEM ${SQLITE3_INCLUDE_DIR})
|
||||
include_directories(BEFORE raster)
|
||||
include_directories(BEFORE mesh)
|
||||
|
||||
|
@ -2331,7 +2331,6 @@ target_include_directories(qgis_core SYSTEM PUBLIC
|
||||
${${QT_VERSION_BASE}Concurrent_INCLUDE_DIRS}
|
||||
${LIBZIP_INCLUDE_DIRS}
|
||||
${SPATIALINDEX_INCLUDE_DIR} # before GEOS for case-insensitive filesystems
|
||||
${SQLITE3_INCLUDE_DIR}
|
||||
${QCA_INCLUDE_DIR}
|
||||
${${QT_VERSION_BASE}SerialPort_INCLUDE_DIRS}
|
||||
${Protobuf_INCLUDE_DIRS}
|
||||
@ -2512,7 +2511,7 @@ target_link_libraries(qgis_core
|
||||
GDAL::GDAL
|
||||
${SPATIALINDEX_LIBRARY}
|
||||
EXPAT::EXPAT
|
||||
${SQLITE3_LIBRARY}
|
||||
SQLite::SQLite3
|
||||
${LIBZIP_LIBRARY}
|
||||
$<TARGET_NAME_IF_EXISTS:protobuf::libprotobuf-lite>
|
||||
${ZLIB_LIBRARIES}
|
||||
|
@ -90,11 +90,11 @@ if (WITH_INTERNAL_MDAL)
|
||||
set (HAVE_HDF5 TRUE)
|
||||
endif()
|
||||
|
||||
if(SQLITE3_FOUND)
|
||||
if(SQLite3_FOUND)
|
||||
set(HAVE_SQLITE3 TRUE)
|
||||
endif()
|
||||
|
||||
if(SQLITE3_FOUND AND NETCDF_FOUND)
|
||||
if(SQLite3_FOUND AND NETCDF_FOUND)
|
||||
set(MDAL_LIB_SRCS ${MDAL_LIB_SRCS}
|
||||
${CMAKE_SOURCE_DIR}/external/mdal/frmts/mdal_sqlite3.cpp
|
||||
${CMAKE_SOURCE_DIR}/external/mdal/frmts/mdal_3di.cpp
|
||||
|
@ -30,7 +30,6 @@ include_directories(
|
||||
include_directories(SYSTEM
|
||||
${LIBZIP_INCLUDE_DIRS}
|
||||
${SPATIALINDEX_INCLUDE_DIR}
|
||||
${SQLITE3_INCLUDE_DIR}
|
||||
${QCA_INCLUDE_DIR}
|
||||
${QTKEYCHAIN_INCLUDE_DIR}
|
||||
)
|
||||
|
@ -19,13 +19,9 @@ include_directories(
|
||||
|
||||
${CMAKE_BINARY_DIR}
|
||||
)
|
||||
include_directories(SYSTEM
|
||||
${SQLITE3_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
target_link_libraries(qgis_bench
|
||||
qgis_core
|
||||
${SQLITE3_LIBRARY}
|
||||
${QT_VERSION_BASE}::Core
|
||||
${QT_VERSION_BASE}::Network
|
||||
${QT_VERSION_BASE}::Svg
|
||||
|
Loading…
x
Reference in New Issue
Block a user