FindSQLite3.cmake 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. ${SQLITE3_INCLUDE_DIRS}
  27. )
  28. find_library(SQLITE3_LIBRARY
  29. NAMES
  30. sqlite3 sqlite3-0
  31. PATHS
  32. ${_SQLITE3_LIBDIR}
  33. ${SQLITE3_LIBRARIES}
  34. )
  35. set(SQLITE3_INCLUDE_DIRS
  36. ${SQLITE3_INCLUDE_DIR}
  37. )
  38. if (SQLITE3_LIBRARY)
  39. set(SQLITE3_LIBRARIES
  40. ${SQLITE3_LIBRARIES}
  41. ${SQLITE3_LIBRARY}
  42. )
  43. endif (SQLITE3_LIBRARY)
  44. if (SQLite3_FIND_VERSION AND _SQLITE3_VERSION)
  45. set(SQLite3_VERSION _SQLITE3_VERSION)
  46. endif (SQLite3_FIND_VERSION AND _SQLITE3_VERSION)
  47. include(FindPackageHandleStandardArgs)
  48. find_package_handle_standard_args(SQLite3 DEFAULT_MSG SQLITE3_LIBRARIES SQLITE3_INCLUDE_DIRS)
  49. # show the SQLITE3_INCLUDE_DIRS and SQLITE3_LIBRARIES variables only in the advanced view
  50. mark_as_advanced(SQLITE3_INCLUDE_DIRS SQLITE3_LIBRARIES)