Commit 20e83aa4 by Przemyslaw Pawelczyk

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.
parent 911fd457
...@@ -33,12 +33,23 @@ ELSEIF () ...@@ -33,12 +33,23 @@ ELSEIF ()
SET(SHA1_TYPE "builtin" CACHE STRING "Which SHA1 implementation to use: builtin, ppc") SET(SHA1_TYPE "builtin" CACHE STRING "Which SHA1 implementation to use: builtin, ppc")
ENDIF () ENDIF ()
# Try to find SQLite3 to compile the SQLite backend INCLUDE(FindPkgConfig)
IF (NOT WIN32)
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) pkg_check_modules(SQLITE3 sqlite3)
ENDIF () ENDIF ()
# Compile SQLite backend if SQLite3 is available
IF (SQLITE3_FOUND) IF (SQLITE3_FOUND)
ADD_DEFINITIONS(-DGIT2_SQLITE_BACKEND) ADD_DEFINITIONS(-DGIT2_SQLITE_BACKEND)
INCLUDE_DIRECTORIES(${SQLITE3_INCLUDE_DIRS}) INCLUDE_DIRECTORIES(${SQLITE3_INCLUDE_DIRS})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment