annotate Resources/CMake/SQLiteConfiguration.cmake @ 3973:d86bddb50972

fix spelling errors according to debian
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 22 May 2020 18:40:35 +0200
parents a3e38994d95a
children f9863630ec7f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1475
3a5b8ed2d859 fix for OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1414
diff changeset
1 if (APPLE)
3a5b8ed2d859 fix for OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1414
diff changeset
2 # Under OS X, the binaries must always be linked against the
3a5b8ed2d859 fix for OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1414
diff changeset
3 # system-wide version of SQLite. Otherwise, if some Orthanc plugin
3a5b8ed2d859 fix for OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1414
diff changeset
4 # also uses its own version of SQLite (such as orthanc-webviewer),
3a5b8ed2d859 fix for OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1414
diff changeset
5 # this results in a crash in "sqlite3_mutex_enter(db->mutex);" (the
3a5b8ed2d859 fix for OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1414
diff changeset
6 # mutex is not initialized), probably because the EXE and the DYNLIB
3a5b8ed2d859 fix for OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1414
diff changeset
7 # share the same memory location for this mutex.
3a5b8ed2d859 fix for OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1414
diff changeset
8 set(SQLITE_STATIC OFF)
3a5b8ed2d859 fix for OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1414
diff changeset
9
3a5b8ed2d859 fix for OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1414
diff changeset
10 elseif (STATIC_BUILD OR NOT USE_SYSTEM_SQLITE)
3a5b8ed2d859 fix for OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1414
diff changeset
11 set(SQLITE_STATIC ON)
3a5b8ed2d859 fix for OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1414
diff changeset
12 else()
3a5b8ed2d859 fix for OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1414
diff changeset
13 set(SQLITE_STATIC OFF)
3a5b8ed2d859 fix for OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1414
diff changeset
14 endif()
3a5b8ed2d859 fix for OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1414
diff changeset
15
3a5b8ed2d859 fix for OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1414
diff changeset
16
3a5b8ed2d859 fix for OS X
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1414
diff changeset
17 if (SQLITE_STATIC)
3291
508fa367c493 upgrade to sqlite amalgamation 3.27.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3133
diff changeset
18 SET(SQLITE_SOURCES_DIR ${CMAKE_BINARY_DIR}/sqlite-amalgamation-3270100)
508fa367c493 upgrade to sqlite amalgamation 3.27.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3133
diff changeset
19 SET(SQLITE_MD5 "16717b26358ba81f0bfdac07addc77da")
508fa367c493 upgrade to sqlite amalgamation 3.27.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3133
diff changeset
20 SET(SQLITE_URL "http://orthanc.osimis.io/ThirdPartyDownloads/sqlite-amalgamation-3270100.zip")
1537
fbf763bb1fa3 error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1475
diff changeset
21
3291
508fa367c493 upgrade to sqlite amalgamation 3.27.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3133
diff changeset
22 add_definitions(-DORTHANC_SQLITE_VERSION=3027001)
2302
f31dfb131dee fix backward compatibility with SQLite < 3.19.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2186
diff changeset
23
1537
fbf763bb1fa3 error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1475
diff changeset
24 DownloadPackage(${SQLITE_MD5} ${SQLITE_URL} "${SQLITE_SOURCES_DIR}")
735
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
25
1414
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1335
diff changeset
26 set(SQLITE_SOURCES
735
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
27 ${SQLITE_SOURCES_DIR}/sqlite3.c
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
28 )
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
29
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
30 add_definitions(
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
31 # For SQLite to run in the "Serialized" thread-safe mode
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
32 # http://www.sqlite.org/threadsafe.html
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
33 -DSQLITE_THREADSAFE=1
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
34 -DSQLITE_OMIT_LOAD_EXTENSION # Disable SQLite plugins
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
35 )
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
36
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
37 include_directories(
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
38 ${SQLITE_SOURCES_DIR}
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
39 )
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
40
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
41 source_group(ThirdParty\\SQLite REGULAR_EXPRESSION ${SQLITE_SOURCES_DIR}/.*)
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
42
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
43 else()
3833
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3291
diff changeset
44 CHECK_INCLUDE_FILE(sqlite3.h HAVE_SQLITE_H)
735
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
45 if (NOT HAVE_SQLITE_H)
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
46 message(FATAL_ERROR "Please install the libsqlite3-dev package")
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
47 endif()
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
48
3833
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3291
diff changeset
49 find_path(SQLITE_INCLUDE_DIR
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3291
diff changeset
50 NAMES sqlite3.h
a3e38994d95a compilation on mips qemu
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3291
diff changeset
51 PATHS
1335
4bed63189508 enhanced header lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1334
diff changeset
52 /usr/include
4bed63189508 enhanced header lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1334
diff changeset
53 /usr/local/include
4bed63189508 enhanced header lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1334
diff changeset
54 )
1334
7f0aa3c0f659 code improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 735
diff changeset
55 message("SQLite include dir: ${SQLITE_INCLUDE_DIR}")
7f0aa3c0f659 code improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 735
diff changeset
56
735
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
57 # Autodetection of the version of SQLite
1334
7f0aa3c0f659 code improvements
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 735
diff changeset
58 file(STRINGS "${SQLITE_INCLUDE_DIR}/sqlite3.h" SQLITE_VERSION_NUMBER1 REGEX "#define SQLITE_VERSION_NUMBER.*$")
2302
f31dfb131dee fix backward compatibility with SQLite < 3.19.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2186
diff changeset
59 string(REGEX REPLACE "#define SQLITE_VERSION_NUMBER(.*)$" "\\1" SQLITE_VERSION_NUMBER2 ${SQLITE_VERSION_NUMBER1})
f31dfb131dee fix backward compatibility with SQLite < 3.19.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2186
diff changeset
60
f31dfb131dee fix backward compatibility with SQLite < 3.19.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2186
diff changeset
61 # Remove the trailing spaces to convert the string to a proper integer
f31dfb131dee fix backward compatibility with SQLite < 3.19.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2186
diff changeset
62 string(STRIP ${SQLITE_VERSION_NUMBER2} SQLITE_VERSION_NUMBER)
735
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
63
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
64 message("Detected version of SQLite: ${SQLITE_VERSION_NUMBER}")
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
65
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
66 IF (${SQLITE_VERSION_NUMBER} LESS 3007000)
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
67 # "sqlite3_create_function_v2" is not defined in SQLite < 3.7.0
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
68 message(FATAL_ERROR "SQLite version must be above 3.7.0. Please set the CMake variable USE_SYSTEM_SQLITE to OFF.")
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
69 ENDIF()
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
70
2302
f31dfb131dee fix backward compatibility with SQLite < 3.19.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2186
diff changeset
71 add_definitions(-DORTHANC_SQLITE_VERSION=${SQLITE_VERSION_NUMBER})
f31dfb131dee fix backward compatibility with SQLite < 3.19.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2186
diff changeset
72
735
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
73 link_libraries(sqlite3)
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
74 endif()