Skip to content

Commit 0d2294e

Browse files
committed
Allow building of sqlite JSON1 extension when building internal sqlite library
1 parent 9106e8d commit 0d2294e

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ endif ()
228228
option(SQLITECPP_INTERNAL_SQLITE "Add the internal SQLite3 source to the project." ON)
229229
if (SQLITECPP_INTERNAL_SQLITE)
230230
message(STATUS "Compile sqlite3 from source in subdirectory")
231+
option(SQLITE_ENABLE_JSON1 "Enable JSON1 extension when building internal sqlite3 library." ON)
231232
# build the SQLite3 C library (for ease of use/compatibility) versus Linux sqlite3-dev package
232233
add_subdirectory(sqlite3)
233234
target_link_libraries(SQLiteCpp PUBLIC sqlite3)

sqlite3/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ if (SQLITE_ENABLE_COLUMN_METADATA)
2121
target_compile_definitions(sqlite3 PUBLIC SQLITE_ENABLE_COLUMN_METADATA)
2222
endif (SQLITE_ENABLE_COLUMN_METADATA)
2323

24+
if (SQLITE_ENABLE_JSON1)
25+
# Enable JSON1 extension when building sqlite3
26+
# See more here: https://www.sqlite.org/json1.html
27+
target_compile_definitions(sqlite3 PUBLIC SQLITE_ENABLE_JSON1)
28+
endif (SQLITE_ENABLE_JSON1)
29+
2430
if (UNIX AND (CMAKE_COMPILER_IS_GNUCXX OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang"))
2531
set_target_properties(sqlite3 PROPERTIES COMPILE_FLAGS "-fPIC")
2632
endif (UNIX AND (CMAKE_COMPILER_IS_GNUCXX OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang"))

0 commit comments

Comments
 (0)