[alsa] Add cmake wrapper (#30960)

* [alsa] Add cmake wrapper.

This adds the imported location for both Debug and Release
configurations, and sets the target's INTERFACE_LINK_LIBRARIES and the
ALSA_LIBRARIES variable to the same libraries as the pkg-config file.

* [alsa] Update baseline.
This commit is contained in:
Pierre Wendling 2023-04-20 18:57:59 -04:00 committed by GitHub
parent 38b5cc29ab
commit 72d359ae10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 105 additions and 1 deletions

View File

@ -57,6 +57,8 @@ vcpkg_configure_make(
vcpkg_install_make()
vcpkg_fixup_pkgconfig()
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/share"

View File

@ -0,0 +1,96 @@
find_path(
ALSA_INCLUDE_DIR
NAMES alsa/asoundlib.h
PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include"
NO_DEFAULT_PATH
)
find_library(
ALSA_LIBRARY_DEBUG
NAMES asound
PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib"
NO_DEFAULT_PATH
)
find_library(
ALSA_LIBRARY_RELEASE
NAMES asound
PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib"
NO_DEFAULT_PATH
)
include(SelectLibraryConfigurations)
select_library_configurations(ALSA)
unset(ALSA_FOUND)
if(NOT ALSA_INCLUDE_DIR OR NOT ALSA_LIBRARY)
message(FATAL_ERROR "Broken installation of the alsa vcpkg port")
endif()
_find_package(${ARGS})
if(TARGET ALSA::ALSA)
if(ALSA_LIBRARY_DEBUG)
set_property(
TARGET ALSA::ALSA
APPEND
PROPERTY IMPORTED_CONFIGURATIONS DEBUG
)
set_target_properties(
ALSA::ALSA
PROPERTIES
IMPORTED_LOCATION_DEBUG "${ALSA_LIBRARY_DEBUG}"
)
endif()
if(ALSA_LIBRARY_RELEASE)
set_property(
TARGET ALSA::ALSA
APPEND
PROPERTY IMPORTED_CONFIGURATIONS RELEASE
)
set_target_properties(
ALSA::ALSA
PROPERTIES
IMPORTED_LOCATION_RELEASE "${ALSA_LIBRARY_RELEASE}"
)
endif()
find_library(Z_VCPKG_HAS_LIBM NAMES m)
if(Z_VCPKG_HAS_LIBM)
list(APPEND ALSA_LIBRARIES m)
set_property(
TARGET ALSA::ALSA
APPEND
PROPERTY INTERFACE_LINK_LIBRARIES m
)
endif()
if(CMAKE_DL_LIBS)
list(APPEND ALSA_LIBRARIES ${CMAKE_DL_LIBS})
set_property(
TARGET ALSA::ALSA
APPEND
PROPERTY INTERFACE_LINK_LIBRARIES ${CMAKE_DL_LIBS}
)
endif()
find_package(Threads)
if(TARGET Threads::Threads)
list(APPEND ALSA_LIBRARIES Threads::Threads)
set_property(
TARGET ALSA::ALSA
APPEND
PROPERTY INTERFACE_LINK_LIBRARIES Threads::Threads
)
endif()
find_library(Z_VCPKG_HAS_LIBRT NAMES rt)
if(Z_VCPKG_HAS_LIBRT)
list(APPEND ALSA_LIBRARIES rt)
set_property(
TARGET ALSA::ALSA
APPEND
PROPERTY INTERFACE_LINK_LIBRARIES rt
)
endif()
endif()

View File

@ -1,6 +1,7 @@
{
"name": "alsa",
"version": "1.2.8",
"port-version": 1,
"description": "The Advanced Linux Sound Architecture (ALSA) - library",
"homepage": "https://www.alsa-project.org/",
"license": "LGPL-2.1-or-later",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "18d67806b319dea0e3c2e9c921a1864901af1d22",
"version": "1.2.8",
"port-version": 1
},
{
"git-tree": "1e4f79a1681c6c40c4b500bf4c8c5d3746916bab",
"version": "1.2.8",

View File

@ -90,7 +90,7 @@
},
"alsa": {
"baseline": "1.2.8",
"port-version": 0
"port-version": 1
},
"amd-amf": {
"baseline": "1.4.29",