aboutsummaryrefslogtreecommitdiff
path: root/cmake/FindSQLite3.cmake
diff options
context:
space:
mode:
authorMarvin W <git@larma.de>2017-03-23 17:10:45 +0100
committerMarvin W <git@larma.de>2017-03-23 17:16:08 +0100
commite6f89f8751e6e65d4a36a125cc3fe398098ba504 (patch)
tree54acce89355ee07b05db761d6d0dad8dad4e0f36 /cmake/FindSQLite3.cmake
parentef0483765a0fd567f25b1f0af6df04e8973e5624 (diff)
downloaddino-e6f89f8751e6e65d4a36a125cc3fe398098ba504.tar.gz
dino-e6f89f8751e6e65d4a36a125cc3fe398098ba504.zip
New CMake
- add install and uninstall targets - compatibility for systems without pkg-config
Diffstat (limited to 'cmake/FindSQLite3.cmake')
-rw-r--r--cmake/FindSQLite3.cmake22
1 files changed, 22 insertions, 0 deletions
diff --git a/cmake/FindSQLite3.cmake b/cmake/FindSQLite3.cmake
new file mode 100644
index 00000000..bf258997
--- /dev/null
+++ b/cmake/FindSQLite3.cmake
@@ -0,0 +1,22 @@
+include(PkgConfigWithFallback)
+find_pkg_config_with_fallback(SQLite3
+ PKG_CONFIG_NAME sqlite3
+ LIB_NAMES sqlite3
+ INCLUDE_NAMES sqlite3.h
+)
+
+if(SQLite3_FOUND AND NOT SQLite3_VERSION)
+ find_path(SQLite3_INCLUDE_DIR "sqlite3.h" HINTS ${SQLite3_INCLUDE_DIRS})
+
+ if(SQLite3_INCLUDE_DIR)
+ file(STRINGS "${SQLite3_INCLUDE_DIR}/sqlite3.h" SQLite3_VERSION REGEX "^#define SQLITE_VERSION +\\\"[^\\\"]+\\\"")
+ string(REGEX REPLACE "^#define SQLITE_VERSION +\\\"([0-9]+)\\.([0-9]+)\\.([0-9]+)\\\"$" "\\1.\\2.\\3" SQLite3_VERSION "${SQLite3_VERSION}")
+ endif()
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(SQLite3
+ FOUND_VAR SQLite3_FOUND
+ REQUIRED_VARS SQLite3_LIBRARY
+ VERSION_VAR SQLite3_VERSION
+) \ No newline at end of file