From 8cdf8dec703d882b46ca50a769fabb95ffc48e2c Mon Sep 17 00:00:00 2001 From: manuel Date: Thu, 24 Nov 2016 21:27:41 +0100 Subject: sync with upstream --- project/cmake/modules/FindSqlite3.cmake | 49 +++++++++++++++++++++++++-------- 1 file changed, 37 insertions(+), 12 deletions(-) (limited to 'project/cmake/modules/FindSqlite3.cmake') diff --git a/project/cmake/modules/FindSqlite3.cmake b/project/cmake/modules/FindSqlite3.cmake index a47944e..abde0cf 100644 --- a/project/cmake/modules/FindSqlite3.cmake +++ b/project/cmake/modules/FindSqlite3.cmake @@ -1,19 +1,44 @@ -# - Try to find SQLITE3 -# Once done this will define +#.rst: +# FindSqlite3 +# ----------- +# Finds the SQLite3 library # -# SQLITE3_FOUND - system has sqlite3 -# SQLITE3_INCLUDE_DIRS - the sqlite3 include directory -# SQLITE3_LIBRARIES - The sqlite3 libraries +# This will will define the following variables:: +# +# SQLITE3_FOUND - system has SQLite3 +# SQLITE3_INCLUDE_DIRS - the SQLite3 include directory +# SQLITE3_LIBRARIES - the SQLite3 libraries +# +# and the following imported targets:: +# +# SQLite3::SQLite3 - The SQLite3 library if(PKG_CONFIG_FOUND) - pkg_check_modules (SQLITE3 sqlite3) - list(APPEND SQLITE3_INCLUDE_DIRS ${SQLITE3_INCLUDEDIR}) -else() - find_path(SQLITE3_INCLUDE_DIRS sqlite3.h) - find_library(SQLITE3_LIBRARIES sqlite3) + pkg_check_modules(PC_SQLITE3 sqlite3 QUIET) endif() +find_path(SQLITE3_INCLUDE_DIR NAMES sqlite3.h + PATHS ${PC_SQLITE3_INCLUDEDIR}) +find_library(SQLITE3_LIBRARY NAMES sqlite3 + PATHS ${PC_SQLITE3_LIBDIR}) + +set(SQLITE3_VERSION ${PC_SQLITE3_VERSION}) + include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Sqlite3 DEFAULT_MSG SQLITE3_INCLUDE_DIRS SQLITE3_LIBRARIES) +find_package_handle_standard_args(Sqlite3 + REQUIRED_VARS SQLITE3_LIBRARY SQLITE3_INCLUDE_DIR + VERSION_VAR SQLITE3_VERSION) + +if(SQLITE3_FOUND) + set(SQLITE3_INCLUDE_DIRS ${SQLITE3_INCLUDE_DIR}) + set(SQLITE3_LIBRARIES ${SQLITE3_LIBRARY}) + + if(NOT TARGET SQLite3::SQLite3) + add_library(SQLite3::SQLite3 UNKNOWN IMPORTED) + set_target_properties(SQLite3::SQLite3 PROPERTIES + IMPORTED_LOCATION "${SQLITE3_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${SQLITE3_INCLUDE_DIR}") + endif() +endif() -mark_as_advanced(SQLITE3_INCLUDE_DIRS SQLITE3_LIBRARIES) +mark_as_advanced(SQLITE3_INCLUDE_DIR SQLITE3_LIBRARY) -- cgit v1.2.3