Skip to content

Commit

Permalink
Add CMake option SQLITE_ENABLE_DBSTAT_VTAB to enable DBSTAT read-only…
Browse files Browse the repository at this point in the history
… eponymous virtual table extension when building internal sqlite3 library.

See more here: https://www.sqlite.org/dbstat.html

Fix #426 Support building SQLite with with SQLITE_ENABLE_DBSTAT_VTAB compile option

Disabled by default
  • Loading branch information
SRombauts committed May 31, 2023
1 parent 4a85c81 commit 8a3df03
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ option(SQLITECPP_INTERNAL_SQLITE "Add the internal SQLite3 source to the project
if (SQLITECPP_INTERNAL_SQLITE)
message(STATUS "Compile sqlite3 from source in subdirectory")
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
add_subdirectory(sqlite3)
target_link_libraries(SQLiteCpp PUBLIC SQLite::SQLite3)
Expand Down
7 changes: 7 additions & 0 deletions sqlite3/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ if (SQLITE_ENABLE_RTREE)
message(STATUS "Compile sqlite3 with 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"))
set_target_properties(sqlite3 PROPERTIES COMPILE_FLAGS "-fPIC")

Expand Down

0 comments on commit 8a3df03

Please sign in to comment.