-
Notifications
You must be signed in to change notification settings - Fork 212
Add find_package overrides that also work in CONFIG mode (#498) #604
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
Add find_package overrides that also work in CONFIG mode (#498) #604
Conversation
b34fff7 to
121410c
Compare
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.
Thanks a lot for the PR and sorry for taking long to review it! It looks great on first glance, I have one small suggestion for readability. Also I'm not sure why the CI pipelines are not running, do you need to enable GitHub actions for your fork?
121410c to
b9499c0
Compare
|
No worries, thanks for CPM. |
Yep this time it showed the button, thanks for update! Looks like we need to update the tests to support the different behavior based on the CMake version and also run |
b9499c0 to
8497a75
Compare
8497a75 to
8ff2d08
Compare
|
I think I've fixed the issues (patstew#1). I've also added a few checks to the |
TheLartians
left a comment
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.
Looks great, thanks for updating this feature and the according documentation and test changes!
Was there was a reason for the find_package to be disabled previously?
Probably an oversight, good catch!
|
Changes released in |
|
This change breaks my configuration that worked in CPMAddPackage(
NAME TBB
GIT_REPOSITORY https://github.com/oneapi-src/oneTBB.git
GIT_TAG v2021.13.0
EXCLUDE_FROM_ALL YES
SYSTEM YES
)
CPMAddPackage(
NAME OpenSubdiv
GIT_REPOSITORY https://github.com/PixarAnimationStudios/OpenSubdiv.git
GIT_TAG v3_6_0
EXCLUDE_FROM_ALL YES
SYSTEM YES
)Now it can't find |
We'd like to use the latest CPM. The test change is due to cpm-cmake/CPM.cmake#604, which was released as part of [CPM 0.40.3](https://github.com/cpm-cmake/CPM.cmake/releases/tag/v0.40.3). The main change is that CPM produces config files instead of find modules so that CPM-downloaded packages will also be found by `find_package` in CONFIG mode. Authors: - Vyas Ramasubramani (https://github.com/vyasr) Approvers: - Robert Maynard (https://github.com/robertmaynard) URL: #916
CPM currently adds a FindFoo.cmake to the module path to override subsequent find_package calls. This makes sure that works when the find_package call is in CONFIG mode as well. Some of my dependencies use this in their CMakeLists.txt. This is equivalent to the OVERRIDE_FIND_PACKAGE argument to FetchContent, we could add that option to CPMAddPackage, but it seems like this is the intended default behaviour of CPM?
The include(....-extra.cmake) bits are something FetchContent does that's also useful here. They should maybe be added to the Find*.cmake version too?
Fixes #498