diff --git a/CMakeLists.txt b/CMakeLists.txt index f027140..4d4cf88 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,9 @@ cmake_minimum_required(VERSION 3.13...3.19) + +if (VCPKG_LIBSNDFILE) + list(APPEND VCPKG_MANIFEST_FEATURES "vcpkg-libsndfile") +endif() + project(ZMusic VERSION 1.1.12 LANGUAGES C CXX @@ -8,6 +13,8 @@ if (VCPKG_TOOLCHAIN) if(VCPKG_TARGET_TRIPLET MATCHES "-static$") set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") endif() + + option(VCPKG_LIBSNDFILE "Import libsndfile from vcpkg" OFF) endif() list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index c127eeb..0960f77 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -156,6 +156,10 @@ PROPERTIES SOVERSION ${PROJECT_VERSION_MAJOR} ) +if (VCPKG_TOOLCHAIN) + x_vcpkg_install_local_dependencies(TARGETS zmusic zmusiclite DESTINATION ".") +endif() + if(ZMUSIC_INSTALL) install(TARGETS zmusic EXPORT ZMusicFullTargets PUBLIC_HEADER diff --git a/vcpkg.json b/vcpkg.json index 3597d20..a8080f6 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -5,14 +5,18 @@ "description": "GZDoom's music system as a standalone library", "features": { + "vcpkg-libsndfile": + { "description": "Use libsndfile provided by vcpkg.", - "dependencies": [ + "dependencies": + [ { "name": "libsndfile", "default-features": false, "features": [ "mpeg", "external-libs" ] } ] + } }, "dependencies": [ {