Further improve SQLite support for CMake users. Unfortunately previous commit was only a partial fix, because it broke SQLite support on platforms w/o pkg-config, e.g. Windows. To be honest I just forgot about messy Windows. Now if there is no pkg-config, then user must provide two variables: SQLITE3_INCLUDE_DIRS and SQLITE3_LIBRARIES if (s)he wants to use SQLite backend. These variables are added to cmake-gui for her/his convenience unless they are set by FindPkgConfig module. pkg-config should work also now in Cygwin.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7bf491e..30d1d6c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -33,12 +33,23 @@ ELSEIF ()
SET(SHA1_TYPE "builtin" CACHE STRING "Which SHA1 implementation to use: builtin, ppc")
ENDIF ()
-# Try to find SQLite3 to compile the SQLite backend
-IF (NOT WIN32)
- INCLUDE(FindPkgConfig)
+INCLUDE(FindPkgConfig)
+
+# Show SQLite3 settings in GUI (if they won't be found out)
+SET(SQLITE3_INCLUDE_DIRS "" CACHE PATH "SQLite include directory")
+SET(SQLITE3_LIBRARIES "" CACHE FILEPATH "SQLite library")
+
+# Are SQLite3 variables already set up? (poor Windows/no pkg-config/no sqlite3.pc)
+IF (SQLITE3_INCLUDE_DIRS AND SQLITE3_LIBRARIES)
+ SET(SQLITE3_FOUND 1)
+ENDIF ()
+
+# Try to find SQLite3 via pkg-config
+IF (PKG_CONFIG_FOUND AND NOT SQLITE3_FOUND)
pkg_check_modules(SQLITE3 sqlite3)
ENDIF ()
+# Compile SQLite backend if SQLite3 is available
IF (SQLITE3_FOUND)
ADD_DEFINITIONS(-DGIT2_SQLITE_BACKEND)
INCLUDE_DIRECTORIES(${SQLITE3_INCLUDE_DIRS})