FindSQLite3.cmake 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. # - Try to find SQLite3
  2. # Once done this will define
  3. #
  4. # SQLITE3_FOUND - system has SQLite3
  5. # SQLITE3_INCLUDE_DIRS - the SQLite3 include directory
  6. # SQLITE3_LIBRARIES - Link these to use SQLite3
  7. # SQLITE3_DEFINITIONS - Compiler switches required for using SQLite3
  8. #
  9. # Copyright (c) 2009-2013 Andreas Schneider <asn@cryptomilk.org>
  10. #
  11. # Redistribution and use is allowed according to the terms of the New
  12. # BSD license.
  13. # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
  14. #
  15. if (UNIX)
  16. find_package(PkgConfig)
  17. if (PKG_CONFIG_FOUND)
  18. pkg_check_modules(_SQLITE3 sqlite3)
  19. endif (PKG_CONFIG_FOUND)
  20. endif (UNIX)
  21. find_path(SQLITE3_INCLUDE_DIR
  22. NAMES
  23. sqlite3.h
  24. PATHS
  25. ${_SQLITE3_INCLUDEDIR}
  26. )
  27. find_library(SQLITE3_LIBRARY
  28. NAMES
  29. sqlite3
  30. PATHS
  31. ${_SQLITE3_LIBDIR}
  32. )
  33. set(SQLITE3_INCLUDE_DIRS
  34. ${SQLITE3_INCLUDE_DIR}
  35. )
  36. if (SQLITE3_LIBRARY)
  37. set(SQLITE3_LIBRARIES
  38. ${SQLITE3_LIBRARIES}
  39. ${SQLITE3_LIBRARY}
  40. )
  41. endif (SQLITE3_LIBRARY)
  42. if (SQLite3_FIND_VERSION AND _SQLITE3_VERSION)
  43. set(SQLite3_VERSION _SQLITE3_VERSION)
  44. endif (SQLite3_FIND_VERSION AND _SQLITE3_VERSION)
  45. include(FindPackageHandleStandardArgs)
  46. find_package_handle_standard_args(SQLite3 DEFAULT_MSG SQLITE3_LIBRARIES SQLITE3_INCLUDE_DIRS)
  47. # show the SQLITE3_INCLUDE_DIRS and SQLITE3_LIBRARIES variables only in the advanced view
  48. mark_as_advanced(SQLITE3_INCLUDE_DIRS SQLITE3_LIBRARIES)