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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
147
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 123
diff changeset
1 if (STATIC_BUILD OR NOT USE_DYNAMIC_SQLITE)
123
7350aff15193 dynamic sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 8
diff changeset
2 SET(SQLITE_SOURCES_DIR ${CMAKE_BINARY_DIR}/sqlite-amalgamation-3071300)
7350aff15193 dynamic sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 8
diff changeset
3 DownloadPackage("http://www.sqlite.org/sqlite-amalgamation-3071300.zip" "${SQLITE_SOURCES_DIR}" "" "")
8
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
4
123
7350aff15193 dynamic sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 8
diff changeset
5 list(APPEND THIRD_PARTY_SOURCES
7350aff15193 dynamic sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 8
diff changeset
6 ${SQLITE_SOURCES_DIR}/sqlite3.c
7350aff15193 dynamic sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 8
diff changeset
7 )
8
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
8
123
7350aff15193 dynamic sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 8
diff changeset
9 add_definitions(
7350aff15193 dynamic sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 8
diff changeset
10 # For SQLite to run in the "Serialized" thread-safe mode
7350aff15193 dynamic sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 8
diff changeset
11 # http://www.sqlite.org/threadsafe.html
7350aff15193 dynamic sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 8
diff changeset
12 -DSQLITE_THREADSAFE=1
7350aff15193 dynamic sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 8
diff changeset
13 -DSQLITE_OMIT_LOAD_EXTENSION # Disable SQLite plugins
7350aff15193 dynamic sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 8
diff changeset
14 )
8
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
15
123
7350aff15193 dynamic sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 8
diff changeset
16 include_directories(
7350aff15193 dynamic sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 8
diff changeset
17 ${SQLITE_SOURCES_DIR}
7350aff15193 dynamic sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 8
diff changeset
18 )
8
3a584803783e build with visual studio
jodogne
parents: 0
diff changeset
19
123
7350aff15193 dynamic sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 8
diff changeset
20 source_group(ThirdParty\\SQLite REGULAR_EXPRESSION ${SQLITE_SOURCES_DIR}/.*)
7350aff15193 dynamic sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 8
diff changeset
21 else()
7350aff15193 dynamic sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 8
diff changeset
22 CHECK_INCLUDE_FILE_CXX(sqlite3.h HAVE_SQLITE_H)
7350aff15193 dynamic sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 8
diff changeset
23 if (NOT HAVE_SQLITE_H)
7350aff15193 dynamic sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 8
diff changeset
24 message(FATAL_ERROR "Please install the libsqlite3-dev package")
7350aff15193 dynamic sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 8
diff changeset
25 endif()
7350aff15193 dynamic sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 8
diff changeset
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
7350aff15193 dynamic sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 8
diff changeset
38 link_libraries(sqlite3)
7350aff15193 dynamic sqlite
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 8
diff changeset
39 endif()