[libpq] Fix cmake wrapper on Windows, add usage (#17232)

* [libpq] Fix cmake wrapper on Windows, add usage

* update version record

* Fix macro PostgreSQL_LIBRARIES

* update version record

* Update ports/libpq/vcpkg-cmake-wrapper.cmake

Co-authored-by: Alexander Neumann <30894796+Neumann-A@users.noreply.github.com>

* Update ports/libpq/vcpkg-cmake-wrapper.cmake

Co-authored-by: Alexander Neumann <30894796+Neumann-A@users.noreply.github.com>

* Update versions/l-/libpq.json

* Update versions/baseline.json

* Update versions/l-/libpq.json

* Update ports/libpq/vcpkg.json

* Update versions/l-/libpq.json

* Update ports/libpq/vcpkg.json

* Update versions/baseline.json

* Update versions/l-/libpq.json

* Update versions/l-/libpq.json

Co-authored-by: Alexander Neumann <30894796+Neumann-A@users.noreply.github.com>
This commit is contained in:
Jack·Boos·Yu 2021-05-01 02:10:51 +08:00 committed by GitHub
parent d790cb6410
commit d36f68e336
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 25 additions and 8 deletions

View File

@ -326,5 +326,6 @@ else()
endif()
endif()
configure_file(${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake ${CURRENT_PACKAGES_DIR}/share/postgresql/vcpkg-cmake-wrapper.cmake @ONLY)
file(INSTALL ${SOURCE_PATH}/COPYRIGHT DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" "${CURRENT_PACKAGES_DIR}/share/postgresql/vcpkg-cmake-wrapper.cmake" @ONLY)
file(INSTALL "${CURRENT_PORT_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
file(INSTALL "${SOURCE_PATH}/COPYRIGHT" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)

4
ports/libpq/usage Normal file
View File

@ -0,0 +1,4 @@
The package libpq provides CMake integration:
find_package(PostgreSQL REQUIRED)
target_link_libraries(main PRIVATE PostgreSQL::PostgreSQL)

View File

@ -15,27 +15,34 @@ if(PostgreSQL_FOUND AND @USE_DL@)
endif()
endif()
endif()
if(PostgreSQL_FOUND AND TARGET PostgreSQL::PostgreSQL AND "@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static")
foreach(LIB_ITEM pgport pgcommon)
if(PostgreSQL_FOUND AND "@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static")
include(SelectLibraryConfigurations)
foreach(LIB_ITEM libpgport libpgcommon pgport pgcommon)
find_library(PostgreSQL_${LIB_ITEM}_LIBRARY_RELEASE
NAMES ${LIB_ITEM}
PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib" NO_DEFAULT_PATH
)
if(PostgreSQL_${LIB_ITEM}_LIBRARY_RELEASE)
if(TARGET PostgreSQL::PostgreSQL AND PostgreSQL_${LIB_ITEM}_LIBRARY_RELEASE)
set_property(
TARGET PostgreSQL::PostgreSQL
APPEND PROPERTY INTERFACE_LINK_LIBRARIES "\$<\$<NOT:\$<CONFIG:DEBUG>>:${PostgreSQL_${LIB_ITEM}_LIBRARY_RELEASE}>"
)
endif()
find_library(PostgreSQL_${LIB_ITEM}_LIBRARY_DEBUG
NAMES ${LIB_ITEM}
PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib" NO_DEFAULT_PATH
)
if(PostgreSQL_${LIB_ITEM}_LIBRARY_DEBUG)
if(TARGET PostgreSQL::PostgreSQL AND PostgreSQL_${LIB_ITEM}_LIBRARY_DEBUG)
set_property(
TARGET PostgreSQL::PostgreSQL
APPEND PROPERTY INTERFACE_LINK_LIBRARIES "\$<\$<CONFIG:DEBUG>:${PostgreSQL_${LIB_ITEM}_LIBRARY_DEBUG}>"
)
endif()
if (PostgreSQL_${LIB_ITEM}_LIBRARY_RELEASE OR PostgreSQL_${LIB_ITEM}_LIBRARY_DEBUG)
select_library_configurations(PostgreSQL_${LIB_ITEM})
list(APPEND PostgreSQL_LIBRARIES ${PostgreSQL_${LIB_ITEM}_LIBRARY})
endif()
endforeach()
endif()

View File

@ -1,7 +1,7 @@
{
"name": "libpq",
"version": "12.2",
"port-version": 15,
"port-version": 16,
"description": "The official database access API of postgresql",
"homepage": "https://www.postgresql.org/",
"supports": "!uwp",

View File

@ -3394,7 +3394,7 @@
},
"libpq": {
"baseline": "12.2",
"port-version": 15
"port-version": 16
},
"libpqxx": {
"baseline": "7.3.1",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "7c75f4ea669ee37e510cb5d7ea0e39b0a7d3f6cb",
"version": "12.2",
"port-version": 16
},
{
"git-tree": "0108a2846402c326800b0da2ffc9d67daad9fbdb",
"version": "12.2",