[vcpkg script] Test pkg-config integration (#25531)

* Require cmake-user to pass CI

* Update baseline state documentation

* Test pkg-config integration

* Prefer pkgconf

* Make pkgconf required
This commit is contained in:
Kai Pastor 2022-07-07 23:27:38 +02:00 committed by GitHub
parent a7f0aca862
commit fb3190dcc5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 46 additions and 7 deletions

View File

@ -2,13 +2,18 @@
## This file defines the current expected build state of ports in CI.
##
## States
## pass - (default) the port builds in the CI system. If a port is
## missing from this file then it is assumed to build.
## fail - the port does not build in the CI system.
## <unspecified> (default) -
## If a port is missing from this file then it is assumed
## to build successfully if not blocked by a dependency.
## pass - The port must build successfully in the CI system. It is a hard
## error if the port build is blocked by a failed dependency.
## fail - The port build is expected to fail in the CI system.
## This is not necessarily the same as if a port is expected to build
## on a developers machine because it may fail due to the machine
## configuration. When set to fail the CI system will still attempt
## to build the port and will report a CI failure until this file is updated.
## configuration. When set to fail the CI system will silently skip
## the port for pull request CI runs. But the CI system will still
## attempt to build the port in scheduled runs, reporting unexpected
## build success as a CI failure.
## skip - Do not build this port in the CI system.
## This is added to ports that may be flaky or conflict with other
## ports. Please comment for why a port is skipped so it can be
@ -1223,6 +1228,14 @@ angle:x64-uwp=fail
angle:arm64-windows=fail
angle:arm-uwp=fail
cmake-user:arm-uwp=pass
cmake-user:arm64-windows=pass
cmake-user:x64-linux=pass
cmake-user:x64-osx=pass
cmake-user:x64-windows-static-md=pass
cmake-user:x64-windows-static=pass
cmake-user:x64-windows=pass
cmake-user:x86-windows=pass
vcpkg-ci-boost:x64-linux=pass
vcpkg-ci-boost:x64-windows-static-md=pass
vcpkg-ci-boost:x64-windows-static=pass

View File

@ -85,6 +85,9 @@ function(get_packages out_packages cmake_version)
endforeach()
endif()
endif()
if("pkg-check-modules" IN_LIST FEATURES)
list(APPEND packages "ZLIBviaPkgConfig")
endif()
set("${out_packages}" "${packages}" PARENT_SCOPE)
endfunction()

View File

@ -44,6 +44,7 @@ install(TARGETS exe lib
# find_package overload and wrapper
set(FIND_PACKAGES "" CACHE STRING "List of packages to be found and used")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
foreach(package ${FIND_PACKAGES})
string(TOUPPER "${package}" package_upper)
set(CMAKE_FIND_DEBUG_MODE ON)

View File

@ -0,0 +1,11 @@
# `pkgconf` is not recognized before CMake 3.22
find_program(PKG_CONFIG_EXECUTABLE NAMES pkgconf REQUIRED)
find_package(PkgConfig REQUIRED)
pkg_check_modules(PC_ZLIB zlib)
if(PC_ZLIB_FOUND)
if(NOT PC_ZLIB_LDFLAGS)
message(SEND_ERROR "ZLIBviaPkgConfig_LIBRARIES is empty")
endif()
set(ZLIBviaPkgConfig_LIBRARIES "${PC_ZLIB_LDFLAGS}")
set(ZLIBviaPkgConfig_FOUND "${PC_ZLIB_FOUND}")
endif()

View File

@ -1,6 +1,6 @@
{
"name": "cmake-user",
"version-date": "2022-06-11",
"version-date": "2022-07-02",
"description": "Test port to verify the vcpkg toolchain in cmake user projects",
"license": "MIT",
"default-features": [
@ -15,7 +15,8 @@
"default-features": false,
"features": [
"cmake-current",
"find-package"
"find-package",
"pkg-check-modules"
]
},
{
@ -128,6 +129,16 @@
"name": "zlib"
}
]
},
"pkg-check-modules": {
"description": "Test `find_package(PkgConfig)` and pkg_check_modules(...)",
"dependencies": [
{
"name": "pkgconf",
"host": true
},
"zlib"
]
}
}
}