Hide the use of FetchContent behind a flag

FetchContent is now disabled by default, when the project is included as
an subproject by another top-level project.
Also, every usage of FetchContent is behind a separate flag to enable and
disable the usage with granular control.
This commit is contained in:
2024-11-18 17:22:03 +01:00
parent ca9ef16d0d
commit c3eb5e6a62
9 changed files with 100 additions and 63 deletions

View File

@@ -2,8 +2,12 @@
### sqlite3 ###
########################################
FetchContent_Declare(sqlite3 URL "https://www.sqlite.org/2022/sqlite-amalgamation-3400100.zip")
FetchContent_MakeAvailable(sqlite3)
FetchContent_Declare(SQLite3
URL "https://www.sqlite.org/2022/sqlite-amalgamation-3400100.zip"
OVERRIDE_FIND_PACKAGE
)
FetchContent_MakeAvailable(SQLite3)
add_library(sqlite3)
target_sources(sqlite3 PRIVATE
@@ -14,11 +18,8 @@ target_sources(sqlite3 PRIVATE
target_include_directories(sqlite3 PUBLIC ${sqlite3_SOURCE_DIR})
set_target_properties(sqlite3 PROPERTIES FOLDER lib)
### Compile options ###
# refer to https://www.sqlite.org/compile.html
target_compile_definitions(sqlite3 PUBLIC SQLITE_ENABLE_RTREE SQLITE_OMIT_LOAD_EXTENSION)
# Use the same name as the FindSQLite3 script of CMake uses