PostgreSQLConfig.cmake 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. if ("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.5)
  2. message (FATAL_ERROR "CMake >= 2.6.0 required")
  3. endif ()
  4. cmake_policy (PUSH)
  5. cmake_policy (VERSION 2.6...3.18)
  6. # Compute the installation prefix relative to this file.
  7. get_filename_component (_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
  8. if (CMAKE_SIZEOF_VOID_P EQUAL 8)
  9. set (_IMPORT_PREFIX "${_IMPORT_PREFIX}/pgsql-x64")
  10. else()
  11. set (_IMPORT_PREFIX "${_IMPORT_PREFIX}/pgsql-x32")
  12. endif ()
  13. # Create imported target PostgreSQL::PostgreSQL
  14. add_library (PostgreSQL::PostgreSQL SHARED IMPORTED)
  15. set_target_properties (PostgreSQL::PostgreSQL PROPERTIES
  16. INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
  17. INTERFACE_LINK_LIBRARIES "PostgreSQL::SSL;PostgreSQL::Crypto;PostgreSQL::Iconv;PostgreSQL::Intl"
  18. IMPORTED_IMPLIB "${_IMPORT_PREFIX}/lib/libpq.lib"
  19. IMPORTED_LOCATION "${_IMPORT_PREFIX}/lib/libpq.dll"
  20. )
  21. # Dependencies - have to be installed together
  22. add_library (PostgreSQL::SSL INTERFACE IMPORTED)
  23. set_target_properties (PostgreSQL::SSL PROPERTIES LOCATION "${_IMPORT_PREFIX}/bin/ssleay32.dll")
  24. add_library (PostgreSQL::Crypto INTERFACE IMPORTED)
  25. set_target_properties (PostgreSQL::Crypto PROPERTIES LOCATION "${_IMPORT_PREFIX}/bin/libeay32.dll")
  26. add_library (PostgreSQL::Iconv INTERFACE IMPORTED)
  27. add_library (PostgreSQL::Intl INTERFACE IMPORTED)
  28. if (CMAKE_SIZEOF_VOID_P EQUAL 8)
  29. set_target_properties (PostgreSQL::Iconv PROPERTIES LOCATION "${_IMPORT_PREFIX}/bin/libiconv-2.dll")
  30. set_target_properties (PostgreSQL::Intl PROPERTIES LOCATION "${_IMPORT_PREFIX}/bin/libintl-8.dll")
  31. else()
  32. set_target_properties (PostgreSQL::Iconv PROPERTIES LOCATION "${_IMPORT_PREFIX}/bin/libiconv.dll")
  33. set_target_properties (PostgreSQL::Intl PROPERTIES LOCATION "${_IMPORT_PREFIX}/bin/libintl.dll")
  34. endif()
  35. if (CMAKE_VERSION VERSION_LESS 3.1.0)
  36. message (FATAL_ERROR "This file relies on consumers using CMake 3.1.0 or greater.")
  37. endif ()
  38. # Cleanup temporary variables.
  39. set (_IMPORT_PREFIX)
  40. cmake_policy (POP)