FindSqlite.cmake 1.5 KB

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