Mercurial > hg > orthanc
annotate Resources/CMake/SQLiteConfiguration.cmake @ 1377:601d34afdab9
patch for recent versions of MinGW
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 29 May 2015 11:50:14 +0200 |
parents | 4bed63189508 |
children | 0a67a502c90f |
rev | line source |
---|---|
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 | |
1335
4bed63189508
enhanced header lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1334
diff
changeset
|
31 find_path(SQLITE_INCLUDE_DIR sqlite3.h |
4bed63189508
enhanced header lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1334
diff
changeset
|
32 /usr/include |
4bed63189508
enhanced header lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1334
diff
changeset
|
33 /usr/local/include |
4bed63189508
enhanced header lookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1334
diff
changeset
|
34 ) |
1334 | 35 message("SQLite include dir: ${SQLITE_INCLUDE_DIR}") |
36 | |
735 | 37 # Autodetection of the version of SQLite |
1334 | 38 file(STRINGS "${SQLITE_INCLUDE_DIR}/sqlite3.h" SQLITE_VERSION_NUMBER1 REGEX "#define SQLITE_VERSION_NUMBER.*$") |
735 | 39 string(REGEX REPLACE "#define SQLITE_VERSION_NUMBER(.*)$" "\\1" SQLITE_VERSION_NUMBER ${SQLITE_VERSION_NUMBER1}) |
40 | |
41 message("Detected version of SQLite: ${SQLITE_VERSION_NUMBER}") | |
42 | |
43 IF (${SQLITE_VERSION_NUMBER} LESS 3007000) | |
44 # "sqlite3_create_function_v2" is not defined in SQLite < 3.7.0 | |
45 message(FATAL_ERROR "SQLite version must be above 3.7.0. Please set the CMake variable USE_SYSTEM_SQLITE to OFF.") | |
46 ENDIF() | |
47 | |
48 link_libraries(sqlite3) | |
49 endif() |