zibbr

Random 3d and p2p stuff that was originally the beginnings of an overly ambitious p2p virtual world thingy
git clone https://code.literati.org/zibbr.git
Log | Files | Refs

FindSQLITE.cmake (1873B)


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