CMake vcpkg integration of xaudio2redist needs simplifying
walbourn opened this issue · comments
Currently in order to use Audio.h
from a CMake project that uses DirectX Tool Kit for Audio built for Windows 7 compat via the xaudio2redist even via VCPKG requires a fair bit of CMake code in the consuming project:
target_compile_definitions(${PROJECT_NAME} PRIVATE USING_XAUDIO2_REDIST)
if (NOT EXISTS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include/xaudio2redist/xaudio2.h")
message(FATAL_ERROR "VCPKG port 'xaudio2redist' required for DirectX Tool Kit for Audio on Windows 7")
endif()
target_include_directories(${PROJECT_NAME} PRIVATE ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include/xaudio2redist)
target_link_directories(${PROJECT_NAME} PRIVATE ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib)
target_link_libraries(${PROJECT_NAME} PRIVATE xaudio2_9redist.lib)
The xaudio2redist port could use a Findxaudio2redist.cmake file.
Need to update for 1.2.7 anyhow.
Actually 1.2.7 only lasted a day. On to 1.2.8.
Updating of xaudio2redist port on vcpkg is this PR
Updating of directxtk's CMake to use it is in this commit.