Merge pull request #428 Add CMake option SQLITE_ENABLE_DBSTAT_VTAB and SQLITE_ENABLE_RTREE from SRombauts/cmake-sqlite-enable-dbstat-vtab

This commit is contained in:
Sébastien Rombauts 2023-06-12 14:54:27 +02:00 committed by GitHub
commit 164a606004
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 8 deletions

View File

@ -252,7 +252,8 @@ endif ()
option(SQLITECPP_INTERNAL_SQLITE "Add the internal SQLite3 source to the project." ON) option(SQLITECPP_INTERNAL_SQLITE "Add the internal SQLite3 source to the project." ON)
if (SQLITECPP_INTERNAL_SQLITE) if (SQLITECPP_INTERNAL_SQLITE)
message(STATUS "Compile sqlite3 from source in subdirectory") message(STATUS "Compile sqlite3 from source in subdirectory")
option(SQLITE_ENABLE_JSON1 "Enable JSON1 extension when building internal sqlite3 library." ON) option(SQLITE_ENABLE_RTREE "Enable RTree extension when building internal sqlite3 library." OFF)
option(SQLITE_ENABLE_DBSTAT_VTAB "Enable DBSTAT read-only eponymous virtual table extension when building internal sqlite3 library." OFF)
# build the SQLite3 C library (for ease of use/compatibility) versus Linux sqlite3-dev package # build the SQLite3 C library (for ease of use/compatibility) versus Linux sqlite3-dev package
add_subdirectory(sqlite3) add_subdirectory(sqlite3)
target_link_libraries(SQLiteCpp PUBLIC SQLite::SQLite3) target_link_libraries(SQLiteCpp PUBLIC SQLite::SQLite3)

View File

@ -30,18 +30,20 @@ if (SQLITE_ENABLE_COLUMN_METADATA)
target_compile_definitions(sqlite3 PUBLIC SQLITE_ENABLE_COLUMN_METADATA) target_compile_definitions(sqlite3 PUBLIC SQLITE_ENABLE_COLUMN_METADATA)
endif (SQLITE_ENABLE_COLUMN_METADATA) endif (SQLITE_ENABLE_COLUMN_METADATA)
if (SQLITE_ENABLE_JSON1) if (SQLITE_ENABLE_RTREE)
# Enable JSON1 extension when building sqlite3
# See more here: https://www.sqlite.org/json1.html
target_compile_definitions(sqlite3 PUBLIC SQLITE_ENABLE_JSON1)
endif (SQLITE_ENABLE_JSON1)
if(SQLITE_ENABLE_RTREE)
# Enable RTree extension when building sqlite3 # Enable RTree extension when building sqlite3
# See more here: https://sqlite.org/rtree.html # See more here: https://sqlite.org/rtree.html
target_compile_definitions(sqlite3 PUBLIC SQLITE_ENABLE_RTREE) target_compile_definitions(sqlite3 PUBLIC SQLITE_ENABLE_RTREE)
message(STATUS "Compile sqlite3 with SQLITE_ENABLE_RTREE")
endif (SQLITE_ENABLE_RTREE) endif (SQLITE_ENABLE_RTREE)
if (SQLITE_ENABLE_DBSTAT_VTAB)
# Enable DBSTAT extension when building sqlite3
# See more here: https://www.sqlite.org/dbstat.html
target_compile_definitions(sqlite3 PUBLIC SQLITE_ENABLE_DBSTAT_VTAB)
message(STATUS "Compile sqlite3 with SQLITE_ENABLE_DBSTAT_VTAB")
endif (SQLITE_ENABLE_DBSTAT_VTAB)
if (UNIX AND (CMAKE_COMPILER_IS_GNUCXX OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")) if (UNIX AND (CMAKE_COMPILER_IS_GNUCXX OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang"))
set_target_properties(sqlite3 PROPERTIES COMPILE_FLAGS "-fPIC") set_target_properties(sqlite3 PROPERTIES COMPILE_FLAGS "-fPIC")