735
|
1 if (STATIC_BUILD OR NOT USE_SYSTEM_SQLITE)
|
|
2 SET(SQLITE_SOURCES_DIR ${CMAKE_BINARY_DIR}/sqlite-amalgamation-3071300)
|
|
3 DownloadPackage(
|
|
4 "5fbeff9645ab035a1f580e90b279a16d"
|
|
5 "http://www.montefiore.ulg.ac.be/~jodogne/Orthanc/ThirdPartyDownloads/sqlite-amalgamation-3071300.zip"
|
|
6 "${SQLITE_SOURCES_DIR}")
|
|
7
|
|
8 list(APPEND THIRD_PARTY_SOURCES
|
|
9 ${SQLITE_SOURCES_DIR}/sqlite3.c
|
|
10 )
|
|
11
|
|
12 add_definitions(
|
|
13 # For SQLite to run in the "Serialized" thread-safe mode
|
|
14 # http://www.sqlite.org/threadsafe.html
|
|
15 -DSQLITE_THREADSAFE=1
|
|
16 -DSQLITE_OMIT_LOAD_EXTENSION # Disable SQLite plugins
|
|
17 )
|
|
18
|
|
19 include_directories(
|
|
20 ${SQLITE_SOURCES_DIR}
|
|
21 )
|
|
22
|
|
23 source_group(ThirdParty\\SQLite REGULAR_EXPRESSION ${SQLITE_SOURCES_DIR}/.*)
|
|
24
|
|
25 else()
|
|
26 CHECK_INCLUDE_FILE_CXX(sqlite3.h HAVE_SQLITE_H)
|
|
27 if (NOT HAVE_SQLITE_H)
|
|
28 message(FATAL_ERROR "Please install the libsqlite3-dev package")
|
|
29 endif()
|
|
30
|
|
31 # Autodetection of the version of SQLite
|
|
32 file(STRINGS "/usr/include/sqlite3.h" SQLITE_VERSION_NUMBER1 REGEX "#define SQLITE_VERSION_NUMBER.*$")
|
|
33 string(REGEX REPLACE "#define SQLITE_VERSION_NUMBER(.*)$" "\\1" SQLITE_VERSION_NUMBER ${SQLITE_VERSION_NUMBER1})
|
|
34
|
|
35 message("Detected version of SQLite: ${SQLITE_VERSION_NUMBER}")
|
|
36
|
|
37 IF (${SQLITE_VERSION_NUMBER} LESS 3007000)
|
|
38 # "sqlite3_create_function_v2" is not defined in SQLite < 3.7.0
|
|
39 message(FATAL_ERROR "SQLite version must be above 3.7.0. Please set the CMake variable USE_SYSTEM_SQLITE to OFF.")
|
|
40 ENDIF()
|
|
41
|
|
42 link_libraries(sqlite3)
|
|
43 endif()
|