Remove unnecessary project() calls
project() should only be called if the subdirectory, in fact, can be built standalone.
This commit is contained in:
@@ -2,21 +2,24 @@
|
||||
### sqlite3 ###
|
||||
########################################
|
||||
|
||||
project(sqlite3 VERSION 3.40.1)
|
||||
|
||||
FetchContent_Declare(sqlite3 URL "https://www.sqlite.org/2022/sqlite-amalgamation-3400100.zip")
|
||||
FetchContent_MakeAvailable(sqlite3)
|
||||
|
||||
add_library(${PROJECT_NAME})
|
||||
target_sources(${PROJECT_NAME} PRIVATE ${sqlite3_SOURCE_DIR}/sqlite3.c ${sqlite3_SOURCE_DIR}/sqlite3.h ${sqlite3_SOURCE_DIR}/sqlite3ext.h )
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC ${sqlite3_SOURCE_DIR})
|
||||
add_library(sqlite3)
|
||||
target_sources(sqlite3 PRIVATE
|
||||
${sqlite3_SOURCE_DIR}/sqlite3.c
|
||||
${sqlite3_SOURCE_DIR}/sqlite3.h
|
||||
${sqlite3_SOURCE_DIR}/sqlite3ext.h
|
||||
)
|
||||
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES FOLDER lib)
|
||||
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(${PROJECT_NAME} PUBLIC SQLITE_ENABLE_RTREE SQLITE_OMIT_LOAD_EXTENSION)
|
||||
target_compile_definitions(sqlite3 PUBLIC SQLITE_ENABLE_RTREE SQLITE_OMIT_LOAD_EXTENSION)
|
||||
|
||||
# Use the same name as the FindSQLite3 script of CMake uses
|
||||
add_library(SQLite::SQLite3 ALIAS ${PROJECT_NAME})
|
||||
add_library(SQLite::SQLite3 ALIAS sqlite3)
|
||||
|
||||
Reference in New Issue
Block a user