changeset 123:7350aff15193

dynamic sqlite
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 05 Oct 2012 10:19:52 +0200
parents e759f777cb72
children 1267071a697e
files Resources/CMake/SQLiteConfiguration.cmake
diffstat 1 files changed, 24 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/Resources/CMake/SQLiteConfiguration.cmake	Fri Oct 05 09:55:16 2012 +0200
+++ b/Resources/CMake/SQLiteConfiguration.cmake	Fri Oct 05 10:19:52 2012 +0200
@@ -1,19 +1,28 @@
-SET(SQLITE_SOURCES_DIR ${CMAKE_BINARY_DIR}/sqlite-amalgamation-3071300)
-DownloadPackage("http://www.sqlite.org/sqlite-amalgamation-3071300.zip" "${SQLITE_SOURCES_DIR}" "" "")
+if (${STATIC_BUILD})
+  SET(SQLITE_SOURCES_DIR ${CMAKE_BINARY_DIR}/sqlite-amalgamation-3071300)
+  DownloadPackage("http://www.sqlite.org/sqlite-amalgamation-3071300.zip" "${SQLITE_SOURCES_DIR}" "" "")
 
-list(APPEND THIRD_PARTY_SOURCES
-  ${SQLITE_SOURCES_DIR}/sqlite3.c
-  )
+  list(APPEND THIRD_PARTY_SOURCES
+    ${SQLITE_SOURCES_DIR}/sqlite3.c
+    )
 
-add_definitions(
-  # For SQLite to run in the "Serialized" thread-safe mode
-  # http://www.sqlite.org/threadsafe.html
-  -DSQLITE_THREADSAFE=1  
-  -DSQLITE_OMIT_LOAD_EXTENSION  # Disable SQLite plugins
-  )
+  add_definitions(
+    # For SQLite to run in the "Serialized" thread-safe mode
+    # http://www.sqlite.org/threadsafe.html
+    -DSQLITE_THREADSAFE=1  
+    -DSQLITE_OMIT_LOAD_EXTENSION  # Disable SQLite plugins
+    )
 
-include_directories(
-  ${SQLITE_SOURCES_DIR}
-  )
+  include_directories(
+    ${SQLITE_SOURCES_DIR}
+    )
 
-source_group(ThirdParty\\SQLite REGULAR_EXPRESSION ${SQLITE_SOURCES_DIR}/.*)
\ No newline at end of file
+  source_group(ThirdParty\\SQLite REGULAR_EXPRESSION ${SQLITE_SOURCES_DIR}/.*)
+else()
+  CHECK_INCLUDE_FILE_CXX(sqlite3.h HAVE_SQLITE_H)
+  if (NOT HAVE_SQLITE_H)
+    message(FATAL_ERROR "Please install the libsqlite3-dev package")
+  endif()
+
+  link_libraries(sqlite3)
+endif()