Fix support for toolchains that set CMAKE_FIND_ROOT_PATH_MODE_* variables to ONLY #11753
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The vcpkg toolchain in
scripts/buildsystems/vcpkg.cmake
adds the installation prefixes toCMAKE_FIND_ROOT_PATH
, but that directory is not searched directly byfind_package
, but it is prepended to all the usual search paths (for example the one specified byCMAKE_PREFIX_PATH
). To make sure thatfind_package
search in the directory specified inCMAKE_FIND_ROOT_PATH
even ifCMAKE_FIND_ROOT_PATH
is set toONLY
, it is necessary to also add/
toCMAKE_PREFIX_PATH
.This PR ensure that:
works fine, and in general is necessary for any
wasm32-emscripten
port that find its dependencies viafind_package
, as discussed in #11323 (comment) . It probably also fixes #8216, but I did not tested it.Which triplets are supported/not supported? Have you updated the CI baseline?
This fix was developed for ports of the
wasm32-emscripten
triplets, but it probably also applies to other triplets, but it should not affect any officially supported triplet.Does your PR follow the maintainer guide?
Yes.