1 # - Try to find Sqlite 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 # Redistribution and use is allowed according to the terms of the BSD license. 9 # For details see the accompanying COPYING-CMAKE-SCRIPTS file. 10 # 11 12 13 # Copyright (c) 2008, Gilles Caulier, <caulier.gilles (a] gmail.com> 14 # 15 # Redistribution and use is allowed according to the terms of the BSD license. 16 # For details see the accompanying COPYING-CMAKE-SCRIPTS file. 17 18 if ( SQLITE_INCLUDE_DIR AND SQLITE_LIBRARIES ) 19 # in cache already 20 SET(Sqlite_FIND_QUIETLY TRUE) 21 endif ( SQLITE_INCLUDE_DIR AND SQLITE_LIBRARIES ) 22 23 # use pkg-config to get the directories and then use these values 24 # in the FIND_PATH() and FIND_LIBRARY() calls 25 if( NOT WIN32 ) 26 find_package(PkgConfig) 27 28 pkg_check_modules(PC_SQLITE sqlite3) 29 30 set(SQLITE_DEFINITIONS ${PC_SQLITE_CFLAGS_OTHER}) 31 endif( NOT WIN32 ) 32 33 FIND_PATH(SQLITE_INCLUDE_DIR NAMES sqlite3.h 34 PATHS 35 ${PC_SQLITE_INCLUDEDIR} 36 ${PC_SQLITE_INCLUDE_DIRS} 37 ) 38 39 FIND_LIBRARY(SQLITE_LIBRARIES NAMES sqlite3 40 PATHS 41 ${PC_SQLITE_LIBDIR} 42 ${PC_SQLITE_LIBRARY_DIRS} 43 ) 44 45 include(FindPackageHandleStandardArgs) 46 FIND_PACKAGE_HANDLE_STANDARD_ARGS(Sqlite DEFAULT_MSG SQLITE_INCLUDE_DIR SQLITE_LIBRARIES ) 47 48 # show the SQLITE_INCLUDE_DIR and SQLITE_LIBRARIES variables only in the advanced view 49 MARK_AS_ADVANCED(SQLITE_INCLUDE_DIR SQLITE_LIBRARIES ) 50 51