Mercurial > hg > orthanc
annotate Resources/CMake/SQLiteConfiguration.cmake @ 2253:441352e7a9d1
fix
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 25 Jan 2017 14:16:46 +0100 |
parents | 8b51b133bb8b |
children | f31dfb131dee |
rev | line source |
---|---|
1475 | 1 if (APPLE) |
2 # Under OS X, the binaries must always be linked against the | |
3 # system-wide version of SQLite. Otherwise, if some Orthanc plugin | |
4 # also uses its own version of SQLite (such as orthanc-webviewer), | |
5 # this results in a crash in "sqlite3_mutex_enter(db->mutex);" (the | |
6 # mutex is not initialized), probably because the EXE and the DYNLIB | |
7 # share the same memory location for this mutex. | |
8 set(SQLITE_STATIC OFF) | |
9 | |
10 elseif (STATIC_BUILD OR NOT USE_SYSTEM_SQLITE) | |
11 set(SQLITE_STATIC ON) | |
12 else() | |
13 set(SQLITE_STATIC OFF) | |
14 endif() | |
15 | |
16 | |
17 if (SQLITE_STATIC) | |
735 | 18 SET(SQLITE_SOURCES_DIR ${CMAKE_BINARY_DIR}/sqlite-amalgamation-3071300) |
1537
fbf763bb1fa3
error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1475
diff
changeset
|
19 SET(SQLITE_MD5 "5fbeff9645ab035a1f580e90b279a16d") |
2186
8b51b133bb8b
move of third party downloads to the main server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1537
diff
changeset
|
20 SET(SQLITE_URL "http://www.orthanc-server.com/downloads/third-party/sqlite-amalgamation-3071300.zip") |
1537
fbf763bb1fa3
error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1475
diff
changeset
|
21 |
fbf763bb1fa3
error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1475
diff
changeset
|
22 DownloadPackage(${SQLITE_MD5} ${SQLITE_URL} "${SQLITE_SOURCES_DIR}") |
735 | 23 |
1414 | 24 set(SQLITE_SOURCES |
735 | 25 ${SQLITE_SOURCES_DIR}/sqlite3.c |
26 ) | |
27 | |
28 add_definitions( | |
29 # For SQLite to run in the "Serialized" thread-safe mode | |
30 # http://www.sqlite.org/threadsafe.html | |
31 -DSQLITE_THREADSAFE=1 | |
32 -DSQLITE_OMIT_LOAD_EXTENSION # Disable SQLite plugins | |
33 ) | |
34 | |
35 include_directories( | |
36 ${SQLITE_SOURCES_DIR} | |
37 ) | |
38 | |
39 source_group(ThirdParty\\SQLite REGULAR_EXPRESSION ${SQLITE_SOURCES_DIR}/.*) | |
40 | |
41 else() | |
42 CHECK_INCLUDE_FILE_CXX(sqlite3.h HAVE_SQLITE_H) | |
43 if (NOT HAVE_SQLITE_H) | |
44 message(FATAL_ERROR "Please install the libsqlite3-dev package") | |
45 endif() | |
46 | |
1335
4bed63189508
enhanced header lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1334
diff
changeset
|
47 find_path(SQLITE_INCLUDE_DIR sqlite3.h |
4bed63189508
enhanced header lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1334
diff
changeset
|
48 /usr/include |
4bed63189508
enhanced header lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1334
diff
changeset
|
49 /usr/local/include |
4bed63189508
enhanced header lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1334
diff
changeset
|
50 ) |
1334 | 51 message("SQLite include dir: ${SQLITE_INCLUDE_DIR}") |
52 | |
735 | 53 # Autodetection of the version of SQLite |
1334 | 54 file(STRINGS "${SQLITE_INCLUDE_DIR}/sqlite3.h" SQLITE_VERSION_NUMBER1 REGEX "#define SQLITE_VERSION_NUMBER.*$") |
735 | 55 string(REGEX REPLACE "#define SQLITE_VERSION_NUMBER(.*)$" "\\1" SQLITE_VERSION_NUMBER ${SQLITE_VERSION_NUMBER1}) |
56 | |
57 message("Detected version of SQLite: ${SQLITE_VERSION_NUMBER}") | |
58 | |
59 IF (${SQLITE_VERSION_NUMBER} LESS 3007000) | |
60 # "sqlite3_create_function_v2" is not defined in SQLite < 3.7.0 | |
61 message(FATAL_ERROR "SQLite version must be above 3.7.0. Please set the CMake variable USE_SYSTEM_SQLITE to OFF.") | |
62 ENDIF() | |
63 | |
64 link_libraries(sqlite3) | |
65 endif() |