Findpg.cmake 1.1 KB

123456789101112131415161718192021222324252627
  1. # Find PostgreSQL
  2. #
  3. # Find the PostgreSQL includes and library
  4. #
  5. # This module defines PG_INCLUDE_DIRS, where to find header, etc. PG_LIBRARIES,
  6. # the libraries needed to use PostgreSQL. pg_FOUND, If false, do not try to use
  7. # PostgreSQL.
  8. # pg_lib - The imported target library.
  9. find_package(PostgreSQL)
  10. if(PostgreSQL_FOUND)
  11. set(PG_LIBRARIES ${PostgreSQL_LIBRARIES})
  12. set(PG_INCLUDE_DIRS ${PostgreSQL_INCLUDE_DIRS})
  13. message(STATUS "pg inc: " ${PostgreSQL_INCLUDE_DIRS})
  14. add_library(pg_lib INTERFACE IMPORTED)
  15. set_target_properties(pg_lib
  16. PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
  17. "${PostgreSQL_INCLUDE_DIRS}"
  18. INTERFACE_LINK_LIBRARIES
  19. "${PostgreSQL_LIBRARIES}")
  20. mark_as_advanced(PG_INCLUDE_DIRS PG_LIBRARIES)
  21. endif(PostgreSQL_FOUND)
  22. include(FindPackageHandleStandardArgs)
  23. find_package_handle_standard_args(pg
  24. DEFAULT_MSG
  25. PG_LIBRARIES
  26. PG_INCLUDE_DIRS)