Skip to content

Commit fd6a5e4

Browse files
committed
Add SQLITECPP_INTERNAL_SQLITE flag
1 parent 26f6d21 commit fd6a5e4

2 files changed

Lines changed: 16 additions & 7 deletions

File tree

cpp/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ if(WITH_SQLITE)
4343
else()
4444
message(STATUS "Fetching SQLiteCpp ${SQLITECPP_FETCH_TAG}")
4545
include(FetchContent)
46+
# By default SQLiteCpp compiles its own bundled SQLite3 amalgamation. We forward
47+
# this knob (keeping SQLiteCpp's own default, ON) so it can be turned off to link
48+
# the platform's libsqlite3 instead: -DSQLITECPP_INTERNAL_SQLITE=OFF
49+
set(SQLITECPP_INTERNAL_SQLITE ON CACHE BOOL "Compile SQLiteCpp's bundled SQLite3 (OFF links system libsqlite3)")
4650
set(SQLITECPP_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
4751
set(SQLITECPP_BUILD_TESTS OFF CACHE BOOL "" FORCE)
4852
set(SQLITECPP_RUN_CPPLINT OFF CACHE BOOL "" FORCE)

docs/Cpp.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,17 @@ cmake --build build
3030
| `WITH_MYSQL` | `OFF` | Build the MySQL/MariaDB backend (read + write). |
3131
| `SQLiteCpp_ROOT` | *(unset)* | Install prefix of an existing SQLiteCpp. If set, that install is used instead of fetching one. |
3232
| `SQLITECPP_FETCH_TAG` | `3.3.3` | SQLiteCpp git tag fetched with `FetchContent` (used unless `SQLiteCpp_ROOT` is given). |
33+
| `SQLITECPP_INTERNAL_SQLITE` | `ON` | When fetching SQLiteCpp: `ON` compiles its bundled SQLite3; `OFF` links the system `libsqlite3`. Forwarded to SQLiteCpp with its own default. |
3334

3435
**Dependencies** (backend-dependent, system-independent)
3536

36-
| Dependency | Needed for | How it's provided |
37-
|------------|-----------|-------------------|
38-
| C++11 compiler, CMake ≥ 3.14 | always | your toolchain |
39-
| [SQLiteCpp](https://github.com/SRombauts/SQLiteCpp) ≥ 3.x | `WITH_SQLITE` | auto-fetched, or use `-DSQLiteCpp_ROOT` |
40-
| SQLite3 C library | `WITH_SQLITE` | comes with SQLiteCpp (or system `libsqlite3`) |
41-
| MySQL/MariaDB client library | `WITH_MYSQL` | system package (`libmysqlclient` / `libmariadb`) |
42-
| `pthread`, `dl` | always | system |
37+
| Dependency | Needed for | How provided |
38+
|------------|-----------|--------------------------------------------------|
39+
| C++11 , CMake ≥ 3.14 | always | system |
40+
| [SQLiteCpp](https://github.com/SRombauts/SQLiteCpp) ≥ 3.x | `WITH_SQLITE` | auto-fetched, or use `-DSQLiteCpp_ROOT` |
41+
| SQLite3 C library | `WITH_SQLITE` | comes with SQLiteCpp (or system `libsqlite3`) |
42+
| MySQL/MariaDB client | `WITH_MYSQL` | system package (`libmysqlclient` / `libmariadb`) |
43+
| `pthread`, `dl` | always | system |
4344

4445
RCDB's own headers are header-only; the database backends above are the only things you link.
4546
Read on for OS-specific package names and full build/run instructions.
@@ -65,6 +66,10 @@ in one of two ways:
6566
default `3.3.3`) with `FetchContent` and builds it as part of the project. Override the
6667
tag with `-DSQLITECPP_FETCH_TAG=<git-tag>`.
6768

69+
By default the fetched SQLiteCpp compiles its own bundled SQLite3 (SQLiteCpp's default).
70+
To link the platform's SQLite instead — e.g. to share one SQLite with the rest of your
71+
software stack — pass `-DSQLITECPP_INTERNAL_SQLITE=OFF` (needs `libsqlite3` dev headers).
72+
6873
2. **An existing install**, by pointing CMake at its prefix (used when your environment
6974
already provides SQLiteCpp, e.g. gluex):
7075

0 commit comments

Comments
 (0)