comparison Resources/CMake/SQLiteConfiguration.cmake @ 0:02f7a0400a91

initial commit
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 25 Feb 2015 13:45:35 +0100
parents
children 54d5dd1df2e5
comparison
equal deleted inserted replaced
-1:000000000000 0:02f7a0400a91
1 # Orthanc - A Lightweight, RESTful DICOM Store
2 # Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics
3 # Department, University Hospital of Liege, Belgium
4 #
5 # This program is free software: you can redistribute it and/or
6 # modify it under the terms of the GNU Affero General Public License
7 # as published by the Free Software Foundation, either version 3 of
8 # the License, or (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Affero General Public License for more details.
14 #
15 # You should have received a copy of the GNU Affero General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18
19 if (STATIC_BUILD OR NOT USE_SYSTEM_SQLITE)
20 SET(SQLITE_SOURCES_DIR ${CMAKE_BINARY_DIR}/sqlite-amalgamation-3071300)
21 DownloadPackage(
22 "5fbeff9645ab035a1f580e90b279a16d"
23 "http://www.montefiore.ulg.ac.be/~jodogne/Orthanc/ThirdPartyDownloads/sqlite-amalgamation-3071300.zip"
24 "${SQLITE_SOURCES_DIR}")
25
26 list(APPEND SQLITE_SOURCES
27 ${SQLITE_SOURCES_DIR}/sqlite3.c
28 )
29
30 add_definitions(
31 # For SQLite to run in the "Serialized" thread-safe mode
32 # http://www.sqlite.org/threadsafe.html
33 -DSQLITE_THREADSAFE=1
34 -DSQLITE_OMIT_LOAD_EXTENSION # Disable SQLite plugins
35 )
36
37 include_directories(
38 ${SQLITE_SOURCES_DIR}
39 )
40
41 source_group(ThirdParty\\SQLite REGULAR_EXPRESSION ${SQLITE_SOURCES_DIR}/.*)
42
43 else()
44 CHECK_INCLUDE_FILE_CXX(sqlite3.h HAVE_SQLITE_H)
45 if (NOT HAVE_SQLITE_H)
46 message(FATAL_ERROR "Please install the libsqlite3-dev package")
47 endif()
48
49 # Autodetection of the version of SQLite
50 file(STRINGS "/usr/include/sqlite3.h" SQLITE_VERSION_NUMBER1 REGEX "#define SQLITE_VERSION_NUMBER.*$")
51 string(REGEX REPLACE "#define SQLITE_VERSION_NUMBER(.*)$" "\\1" SQLITE_VERSION_NUMBER ${SQLITE_VERSION_NUMBER1})
52
53 message("Detected version of SQLite: ${SQLITE_VERSION_NUMBER}")
54
55 IF (${SQLITE_VERSION_NUMBER} LESS 3007000)
56 # "sqlite3_create_function_v2" is not defined in SQLite < 3.7.0
57 message(FATAL_ERROR "SQLite version must be above 3.7.0. Please set the CMake variable USE_SYSTEM_SQLITE to OFF.")
58 ENDIF()
59
60 link_libraries(sqlite3)
61 endif()