Mercurial > hg > orthanc
annotate Resources/CMake/SQLiteConfiguration.cmake @ 267:2ccf556dc1ce Orthanc-0.3.1
close
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 29 Apr 2013 12:55:01 +0200 |
parents | 0186ac92810c |
children | b45bc565d82a 61ab5fa36754 |
rev | line source |
---|---|
147 | 1 if (STATIC_BUILD OR NOT USE_DYNAMIC_SQLITE) |
123 | 2 SET(SQLITE_SOURCES_DIR ${CMAKE_BINARY_DIR}/sqlite-amalgamation-3071300) |
3 DownloadPackage("http://www.sqlite.org/sqlite-amalgamation-3071300.zip" "${SQLITE_SOURCES_DIR}" "" "") | |
8 | 4 |
123 | 5 list(APPEND THIRD_PARTY_SOURCES |
6 ${SQLITE_SOURCES_DIR}/sqlite3.c | |
7 ) | |
8 | 8 |
123 | 9 add_definitions( |
10 # For SQLite to run in the "Serialized" thread-safe mode | |
11 # http://www.sqlite.org/threadsafe.html | |
12 -DSQLITE_THREADSAFE=1 | |
13 -DSQLITE_OMIT_LOAD_EXTENSION # Disable SQLite plugins | |
14 ) | |
8 | 15 |
123 | 16 include_directories( |
17 ${SQLITE_SOURCES_DIR} | |
18 ) | |
8 | 19 |
123 | 20 source_group(ThirdParty\\SQLite REGULAR_EXPRESSION ${SQLITE_SOURCES_DIR}/.*) |
21 else() | |
22 CHECK_INCLUDE_FILE_CXX(sqlite3.h HAVE_SQLITE_H) | |
23 if (NOT HAVE_SQLITE_H) | |
24 message(FATAL_ERROR "Please install the libsqlite3-dev package") | |
25 endif() | |
26 | |
194
0186ac92810c
fixes for Ubuntu 10.04
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
147
diff
changeset
|
27 # Autodetection of the version of SQLite |
0186ac92810c
fixes for Ubuntu 10.04
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
147
diff
changeset
|
28 file(STRINGS "/usr/include/sqlite3.h" SQLITE_VERSION_NUMBER1 REGEX "#define SQLITE_VERSION_NUMBER.*$") |
0186ac92810c
fixes for Ubuntu 10.04
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
147
diff
changeset
|
29 string(REGEX REPLACE "#define SQLITE_VERSION_NUMBER(.*)$" "\\1" SQLITE_VERSION_NUMBER ${SQLITE_VERSION_NUMBER1}) |
0186ac92810c
fixes for Ubuntu 10.04
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
147
diff
changeset
|
30 |
0186ac92810c
fixes for Ubuntu 10.04
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
147
diff
changeset
|
31 message("Detected version of SQLite: ${SQLITE_VERSION_NUMBER}") |
0186ac92810c
fixes for Ubuntu 10.04
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
147
diff
changeset
|
32 |
0186ac92810c
fixes for Ubuntu 10.04
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
147
diff
changeset
|
33 IF (${SQLITE_VERSION_NUMBER} LESS 3007000) |
0186ac92810c
fixes for Ubuntu 10.04
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
147
diff
changeset
|
34 # "sqlite3_create_function_v2" is not defined in SQLite < 3.7.0 |
0186ac92810c
fixes for Ubuntu 10.04
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
147
diff
changeset
|
35 message(FATAL_ERROR "SQLite version must be above 3.7.0. Please set the CMake variable USE_DYNAMIC_SQLITE to OFF.") |
0186ac92810c
fixes for Ubuntu 10.04
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
147
diff
changeset
|
36 ENDIF() |
0186ac92810c
fixes for Ubuntu 10.04
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
147
diff
changeset
|
37 |
123 | 38 link_libraries(sqlite3) |
39 endif() |