-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
78 lines (61 loc) · 1.96 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Copyright (c) 2014-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed in accordance with the terms specified in
# the LICENSE file found in the root directory of this source tree.
cmake_minimum_required(VERSION 3.21.4)
project(thirdparty_sqlite)
option(SQLITE_ENABLE_INSTALL_TARGET "When enabled, will cause the project to create the install targets" OFF)
option(SQLITE_ENABLE_FULL_TEXT_SEARCH_EXTENSIONS "Set to ON to enable the FTS extensions" OFF)
option(SQLITE_ENABLE_RTREE_EXTENSION "Set to ON to enable the R*Tree module" OFF)
function(sqliteMain)
set(parameter_list
"SQLITE_MAX_VARIABLE_NUMBER=250000"
)
set(option_list
SQLITE_ENABLE_COLUMN_METADATA
SQLITE_SECURE_DELETE
SQLITE_ENABLE_DBSTAT_VTAB
SQLITE_SOUNDEX
SQLITE_ENABLE_EXPLAIN_COMMENTS
)
if(${SQLITE_ENABLE_RTREE_EXTENSION})
message(STATUS "Enabling the SQLite R*Tree module")
list(APPEND option_list
SQLITE_ENABLE_RTREE
)
else()
message(STATUS "Disabling the SQLite R*Tree module")
endif()
if(${SQLITE_ENABLE_FULL_TEXT_SEARCH_EXTENSIONS})
message(STATUS "Enabling the SQLite FTS extensions")
list(APPEND option_list
SQLITE_ENABLE_FTS3
SQLITE_ENABLE_FTS4
SQLITE_ENABLE_FTS3_PARENTHESIS
SQLITE_ENABLE_FTS5
)
else()
message(STATUS "Disabling the SQLite FTS extensions")
endif()
add_library(thirdparty_sqlite
src/sqlite3.c
)
target_compile_definitions(thirdparty_sqlite PRIVATE
${parameter_list}
)
foreach(option ${option_list})
target_compile_definitions(thirdparty_sqlite PRIVATE
"${option}=1"
)
endforeach()
target_include_directories(thirdparty_sqlite INTERFACE
"${CMAKE_CURRENT_SOURCE_DIR}/src"
)
if(SQLITE_ENABLE_INSTALL_TARGET)
message(STATUS "Enabling the install target")
install(TARGETS thirdparty_sqlite DESTINATION lib)
install(FILES src/sqlite3ext.h src/sqlite3.h DESTINATION include)
endif()
endfunction()
sqliteMain()