-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
find_package
in vcpkg.cmake
must honor CMAKE_DISABLE_FIND_PACKAGE_<NAME>
#18631
Comments
Plus: For |
Yes, this is definitely a bug |
Fixed by #18961. |
Please keep this issue open until #18961 merged. |
Describe the bug
In pristine CMake, "every non-
REQUIRED
find_package()
call in a project can be disabled by setting the variableCMAKE_DISABLE_FIND_PACKAGE_<PackageName>
toTRUE
." This means, there are no side effects.vcpkg.cmake
overrides cmake's originalfind_package
. It always includesvcpkg-cmake-wrapper.cmake
for<PackageName>
if it exists:vcpkg/scripts/buildsystems/vcpkg.cmake
Lines 716 to 725 in 876e67c
So all side effects from the wrapper always occur, e.g. failures to load transitive dependencies.
Actual behaviour:
An example of the actual behaviour is seen in current simage build errors for osx: The simage build system is configured with
-DCMAKE_DISABLE_FIND_PACKAGE_TIFF=ON
. Still, iff port tiff happens to be already installed (and quicktime is not available), the wrapper for TIFF is loaded, and it causes an configuration error because the dependencies of TIFF (JPEG, ZLIB) are disabled, too:(From #18393 (comment))
Expected behavior:
For consistency with CMake, no side effects are allowed for non-
REQUIRED
find_package()
calls when the variableCMAKE_DISABLE_FIND_PACKAGE_<PackageName>
is set toTRUE
, i.e.find_package
must return early, without loading wrappers.In the simage example, the TIFF wrapper must not be loaded for the
find_package(TIFF)
call in simage's CMakeLists.txt, due toCMAKE_DISABLE_FIND_PACKAGE_TIFF
being set.The text was updated successfully, but these errors were encountered: