-
Notifications
You must be signed in to change notification settings - Fork 2
/
FindSQLITE.cmake
executable file
·51 lines (45 loc) · 1.79 KB
/
FindSQLITE.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# - Try to find the SQLITE library
# Once done this will define
#
# SQLITE_FOUND - system has sqlite
# SQLITE_INCLUDE_DIR - the sqlite include directory
# SQLITE_LIBRARIES - Link these to use sqlite
# SQLITE_DEFINITIONS - Compiler switches required for using sqlite
#
IF (SQLITE_LIBRARIES AND SQLITE_INCLUDE_DIR)
SET(SQLITE_FIND_QUIETLY TRUE) # Already in cache, be silent
ENDIF (SQLITE_LIBRARIES AND SQLITE_INCLUDE_DIR)
IF (WIN32) #Windows
MESSAGE(STATUS "Using SQLite3 in dependencies")
SET(SQLITE_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/dependencies/sqlite3)
FILE(GLOB SQLITE_SOURCE ${SQLITE_INCLUDE_DIR}/*.c)
ADD_LIBRARY(sqlite3 ${SQLITE_SOURCE})
SET( SQLITE_LIBRARIES sqlite3)
INCLUDE_DIRECTORIES("${SQLITE_INCLUDE_DIR}")
ELSE (WIN32) #Unix
CMAKE_MINIMUM_REQUIRED(VERSION 2.4.7 FATAL_ERROR)
FIND_PACKAGE(PkgConfig)
PKG_SEARCH_MODULE(SQLITE sqlite3)
SET(SQLITE_INCLUDE_DIR ${SQLITE_INCLUDE_DIRS})
SET(SQLITE_LIB_DIR ${SQLITE_LIBDIR})
SET(SQLITE_LIBRARIES ${SQLITE_LIBRARIES} CACHE STRING "")
ENDIF (WIN32)
#Do some preparation
SEPARATE_ARGUMENTS(SQLITE_INCLUDE_DIR)
SEPARATE_ARGUMENTS(SQLITE_LIBRARIES)
SET(SQLITE_INCLUDE_DIR ${SQLITE_INCLUDE_DIR} CACHE PATH "")
SET(SQLITE_LIBRARIES ${SQLITE_LIBRARIES} CACHE STRING "")
SET(SQLITE_LIB_DIR ${SQLITE_LIB_DIR} CACHE PATH "")
IF (SQLITE_INCLUDE_DIR AND SQLITE_LIBRARIES)
SET(SQLITE_FOUND TRUE)
ENDIF (SQLITE_INCLUDE_DIR AND SQLITE_LIBRARIES)
IF (SQLITE_FOUND)
IF (NOT SQLITE_FIND_QUIETLY)
MESSAGE(STATUS " libraries : ${SQLITE_LIBRARIES} from ${SQLITE_LIB_DIR}")
MESSAGE(STATUS " includes : ${SQLITE_INCLUDE_DIR}")
ENDIF (NOT SQLITE_FIND_QUIETLY)
ELSE (SQLITE_FOUND)
IF (SQLITE_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find SQLite3")
ENDIF (SQLITE_FIND_REQUIRED)
ENDIF (SQLITE_FOUND)