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.
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
[vcpkg_configure_cmake] Introduce REQUIRE_ALL_PACKAGES #15808
[vcpkg_configure_cmake] Introduce REQUIRE_ALL_PACKAGES #15808
Changes from all commits
52dfb19
49402d1
aaadf6f
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is indirectly providing a
FindGDAL.cmake
via a vcpkg created-config.cmake
. Maybe finally decide to support a CMake module directory?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason why we don't use the module directory approach is twofold:
which would break the "obvious" way to provide a module path.
2. Because vcpkg packages are the "producers", they should provide
-config.cmake
files, which are essentially strictly superior to Find modules (notably they supportfind_dependency()
).I took this approach for GDAL to replace the official target with a config file, since I felt that we could provide the full official interface easily enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concerning 1:
The reason projects does this is because the cmake docs tell them to set it. In my opinion, this is a case of outdated/Wrong docs since
CMAKE_MODULE_PATH
can be provided either by a toolchain or by a superproject/superbuild so only setting the value is conceptually wrong and needs correction. (i.e.list(PREPEND)
or similar is the correct way to go. See e.g. VTK). Modifying&backuping theCMAKE_MODULE_PATH
is for example also done byVTK-Config.cmake
Concerning 2:
If the information is provided by vcpkg it does not matter here if it is
<package>-config.cmake
orFind<package>.cmake
because you can encode the same information in both. The config way would only be superior if you also supply a<configfile>Version.cmake
. Although thefind_dependency
part is correct you just can wrap it into a minimal function in aFind<package>.cmake
to workaround that.My main nitpick here ist that with a
CMAKE_MODULE_PATH
you wouldn't need to use the indirection with thevcpkg-cmake-wrapper.cmake
here. Furthermore redirection of all calls toFindGDAL.cmake
is possibly breaking downstream users with a customFindGDAL.cmake
which does not define the same targets and/or variables as the vcpkg one without a way to bail out. So chose your poison very carefully.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed that the current practice of many projects is "wrong"/"bad", but patching the world is never a good solution.
It is true that we are possibly overriding a package's custom FindGDAL.cmake, however these custom find scripts are (in general) fundamentally broken in the face of static libraries, because there's no way for them to know the precise dependencies that were used during the build. Additionally, as long as we adhere to "only use vcpkg-cmake-wrapper to wrap built-in CMake modules", the probability of custom FindXYZ.cmake scripts is much lower (but non-zero -- we've both seen it happen).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless they are using the
FindPkgConfig
module +pkg_check_modules
in theFind<Package>.cmake
. If they also use theIMPORTED_TARGET
option and link against the created target it should be always correct (unless there is something wrong with the pc files generated by vcpkg). Unfortunately, I have also seen that the results ofpkg_check_modules
is sometimes only used as hinting forfind_library
calls etc. (Source: Qt6)Since I saw a mention of changes to FindGDAL in the CMake 3.20 release notes you might want to have look at in the CMake RC to make sure everything is ok with the config here.
This file was deleted.