fix(soundtouch): remove invalid include directories from exported targets#51085
fix(soundtouch): remove invalid include directories from exported targets#51085Badboy-liu wants to merge 2 commits intomicrosoft:masterfrom
Conversation
|
@microsoft-github-policy-service agree |
4771ef3 to
e8d00dc
Compare
e8d00dc to
5bc2a2e
Compare
|
If vcpkg_cmake_config_fixup is broken we should probably fix it rather than trying to do so piecemeal... |
Thanks for the suggestion! After further investigation, I believe this issue is triggered by how SoundTouch defines its install rules rather than a general problem in vcpkg_cmake_config_fixup. Specifically, SoundTouch uses the following pattern: install(
FILES
include/BPMDetect.h
include/FIFOSampleBuffer.h
include/FIFOSamplePipe.h
include/STTypes.h
include/SoundTouch.h
include/soundtouch_config.h
DESTINATION
"${CMAKE_INSTALL_INCLUDEDIR}/soundtouch"
COMPONENT SoundTouch
)
install(TARGETS SoundTouch
EXPORT SoundTouchTargets
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
COMPONENT SoundTouch
)Here, headers are installed into: But the exported target declares: This creates a mismatch between the actual header layout and the When vcpkg_cmake_config_fixup processes the generated targets, ${_IMPORT_PREFIX}/SoundTouch These paths do not exist and lead to CMake configure errors like: Imported target "SoundTouch::SoundTouch" includes non-existent path To verify this, I created a minimal standalone CMake project reproducing Other ports using vcpkg_cmake_config_fixup do not exhibit this behavior, Given this, my current approach is to fix it at the port level to keep the I'd be very interested in your thoughts — do you think this is better addressed: at the port level (current PR), Happy to follow whichever direction you think is more appropriate. |
|
|
|
#51162 seems to include a proper fix. |
|
Hi, it's a "CMake behavior" about "include_directories". CMake will only see the last one. Reorder target_include_directories in SoundTouch's CMakeLists.txt so that the INSTALL_INTERFACE path is correctly propagated to consumers. Without this fix, find_package(SoundTouch CONFIG) resolves headers from the build/source tree instead of the installed include directory, causing #include <soundtouch/SoundTouch.h> to fail in downstream projects using vcpkg. |
Thanks for the fix! I’ve verified this locally, and the issue is resolved. After the change, find_package(SoundTouch CONFIG) correctly picks up the installed include directory, and <soundtouch/SoundTouch.h> can be included without issues. Everything builds and links fine downstream now. Thanks a lot for the clarification and fix! |
|
Description
The SoundTouch port generates invalid include directories in exported targets:
These paths do not exist and cause CMake configure failure:
Imported target "SoundTouch::SoundTouch" includes non-existent path
Root Cause
The issue appears to come from vcpkg_cmake_config_fixup incorrectly handling
the COMPONENT field from install(EXPORT ...).
This is not an upstream issue.
Fix
This patch removes invalid include directories from generated *Targets.cmake files.
Testing
Impact
This patch is scoped only to SoundTouch and does not affect other ports.