Files
MaxScale/query_classifier/qc_sqlite/CMakeLists.txt
Markus Mäkelä d67320e06a Fix more GCC 8 build failures
Fixed string truncation warnings by reducing max parameter lengths by one
where applicable. The binlogrouter filename lengths are slightly different
so using memcpy to work around the warnings is an adequate "solution"
until the root of the problem is solved.

Removed unnecessary CMake policy settings from qc_sqlite. Adding a
self-dependency on the source file of an external project has no effect
and only caused warnings to be logged.
2018-04-23 14:02:54 +03:00

37 lines
1.9 KiB
CMake

include(ExternalProject)
ExternalProject_Add(maxscale_sqlite
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/sqlite-src-3110100
BINARY_DIR ${CMAKE_BINARY_DIR}/sqlite-bld-3110100
CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/sqlite-src-3110100/configure --with-pic --enable-maxscale
BUILD_COMMAND make sqlite3.c
INSTALL_COMMAND "")
include_directories(${CMAKE_BINARY_DIR}/sqlite-bld-3110100/tsrc)
include_directories(${CMAKE_BINARY_DIR}/sqlite-bld-3110100)
include_directories(${MARIADB_CONNECTOR_INCLUDE_DIR})
# GCC thinks there is an array-bounds error in sqlite code.
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-error=array-bounds")
add_library(qc_sqlite SHARED qc_sqlite.cc qc_sqlite3.c builtin_functions.c)
add_dependencies(qc_sqlite maxscale_sqlite)
# If you feel a need to add something here, check also the handling of 'enable_maxscale'
# in sqlite-src-3110100/configure.
# In configure we have defined SQLITE_OMIT_VIRTUALTABLE, but it cannot be defined here,
# although conceptually is should, as one needed static function in case will be missing.
add_definitions(-DMAXSCALE -DSQLITE_THREADSAFE=0 -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT -DSQLITE_OMIT_ATTACH -DSQLITE_OMIT_REINDEX -DSQLITE_OMIT_AUTOVACUUM -DSQLITE_OMIT_PRAGMA )
set_target_properties(qc_sqlite PROPERTIES VERSION "1.0.0")
set_target_properties(qc_sqlite PROPERTIES LINK_FLAGS -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/qc_sqlite.map)
# NOTE: If libqc_sqlite is linked with the link-flags -Wl,-z,defs - that is, all
# NOTE: symbols are resolved at compile time - then for whatever reason, sqlite3_prepare
# NOTE: is *not* taken from sqlite3.c built into this library, but from the sqlite3
# NOTE: shared library on the system. Libmaxscale-common depends on the libsqlite, but
# NOTE: reason is not entirelly understood.
#
# target_link_libraries(qc_sqlite maxscale-common)
# set_target_properties(qc_sqlite PROPERTIES LINK_FLAGS -Wl,-z,defs)
install_module(qc_sqlite core)