Add and use FindSQLite.cmake

Added a find_package module for SQLite development libraries.
This commit is contained in:
Markus Makela 2016-10-28 12:23:47 +03:00
parent 1be3bb9b8d
commit 3c26ea16e2
4 changed files with 42 additions and 12 deletions

View File

@ -44,6 +44,7 @@ find_package(LibUUID)
find_package(Jansson)
find_package(Avro)
find_package(GSSAPI)
find_package(SQLite)
# Find or build PCRE2
# Read BuildPCRE2 for details about how to add pcre2 as a dependency to a target

View File

@ -1,9 +1,9 @@
# This CMake file locates the Jansson libraries and headers
#
# The following variables are set:
# JANSSON_FOUND - If the Avro C library was found
# JANSSON_FOUND - If the Jansson library was found
# JANSSON_LIBRARIES - Path to the static library
# JANSSON_INCLUDE_DIR - Path to Avro headers
# JANSSON_INCLUDE_DIR - Path to Jansson headers
find_path(JANSSON_INCLUDE_DIR jansson.h)
find_library(JANSSON_LIBRARIES NAMES libjansson.so libjansson.a)

23
cmake/FindSQLite.cmake Normal file
View File

@ -0,0 +1,23 @@
# This CMake file locates the SQLite3 development libraries
#
# The following variables are set:
# SQLITE_FOUND - If the SQLite library was found
# SQLITE_LIBRARIES - Path to the static library
# SQLITE_INCLUDE_DIR - Path to SQLite headers
# SQLITE_VERSION - Library version
find_path(SQLITE_INCLUDE_DIR sqlite3.h)
find_library(SQLITE_LIBRARIES NAMES libsqlite3.so)
if (SQLITE_INCLUDE_DIR AND SQLITE_LIBRARIES)
execute_process(COMMAND grep ".*#define.*SQLITE_VERSION " ${SQLITE_INCLUDE_DIR}/sqlite3.h
COMMAND sed "s/.*\"\\(.*\\)\".*/\\1/"
OUTPUT_VARIABLE SQLITE_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
message(STATUS "Found SQLite version ${SQLITE_VERSION}: ${SQLITE_LIBRARIES}")
set(SQLITE_FOUND TRUE)
else()
message(STATUS "Could not find SQLite")
endif()

View File

@ -5,18 +5,24 @@ target_link_libraries(MySQLBackendAuth maxscale-common MySQLCommon)
set_target_properties(MySQLBackendAuth PROPERTIES VERSION "1.0.0")
install_module(MySQLBackendAuth core)
if (GSSAPI_FOUND)
include_directories(${GSSAPI_INCS})
if (GSSAPI_FOUND AND SQLITE_FOUND)
if (NOT SQLITE_VERSION VERSION_LESS "3.7.7")
include_directories(${GSSAPI_INCS})
include_directories(${SQLITE_INCLUDE_DIR})
add_library(GSSAPIAuth SHARED gssapi_auth.c gssapi_auth_common.c)
target_link_libraries(GSSAPIAuth maxscale-common ${GSSAPI_LIBS} sqlite3 MySQLCommon)
set_target_properties(GSSAPIAuth PROPERTIES VERSION "1.0.0")
install_module(GSSAPIAuth core)
add_library(GSSAPIAuth SHARED gssapi_auth.c gssapi_auth_common.c)
target_link_libraries(GSSAPIAuth maxscale-common ${GSSAPI_LIBS} ${SQLITE_LIBRARIES} MySQLCommon)
set_target_properties(GSSAPIAuth PROPERTIES VERSION "1.0.0")
install_module(GSSAPIAuth core)
add_library(GSSAPIBackendAuth SHARED gssapi_backend_auth.c gssapi_auth_common.c)
target_link_libraries(GSSAPIBackendAuth maxscale-common ${GSSAPI_LIBS} MySQLCommon)
set_target_properties(GSSAPIBackendAuth PROPERTIES VERSION "1.0.0")
install_module(GSSAPIBackendAuth core)
add_library(GSSAPIBackendAuth SHARED gssapi_backend_auth.c gssapi_auth_common.c)
target_link_libraries(GSSAPIBackendAuth maxscale-common ${GSSAPI_LIBS} MySQLCommon)
set_target_properties(GSSAPIBackendAuth PROPERTIES VERSION "1.0.0")
install_module(GSSAPIBackendAuth core)
else()
message(STATUS "Minimum requires SQLite version for GSSAPIAuth is 3.7.7, current SQLite version is ${SQLITE_VERSION}")
endif()
endif()
add_library(NullAuthAllow SHARED null_auth_allow.c)