-
Notifications
You must be signed in to change notification settings - Fork 63
Leverage CMake 4.2 introduction of UNWIND_INCLUDE for find_package
#888
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
Open
robertmaynard
wants to merge
3
commits into
rapidsai:main
Choose a base branch
from
robertmaynard:leverage_unwind_find_dependency
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 12 additions & 2 deletions
14
rapids-cmake/export/template/build_package_components.cmake.in
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 13 additions & 3 deletions
16
rapids-cmake/export/template/build_package_components_versioned.cmake.in
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 12 additions & 3 deletions
15
rapids-cmake/export/template/build_package_versioned.cmake.in
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,9 @@ | ||
| find_dependency(@name@) | ||
| if(CMAKE_VERSION VERSION_GREATER_EQUAL 4.2.0) | ||
| __find_dependency_no_return(@name@) | ||
| if(NOT @name@_FOUND) | ||
| unset(_cmake_unwind_arg) | ||
| return() | ||
| endif() | ||
| else | ||
| find_dependency(@name@) | ||
| endif() |
10 changes: 9 additions & 1 deletion
10
rapids-cmake/export/template/install_package_components.cmake.in
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,9 @@ | ||
| find_dependency(@name@ COMPONENTS @components@) | ||
| if(CMAKE_VERSION VERSION_GREATER_EQUAL 4.2.0) | ||
| __find_dependency_no_return(@name@ COMPONENTS @components@) | ||
| if(NOT @name@_FOUND) | ||
| unset(_cmake_unwind_arg) | ||
| return() | ||
| endif() | ||
| else | ||
| find_dependency(@name@) | ||
| endif() |
13 changes: 11 additions & 2 deletions
13
rapids-cmake/export/template/install_package_components_versioned.cmake.in
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,11 @@ | ||
| find_package(@name@ @version@ QUIET COMPONENTS @components@) | ||
| find_dependency(@name@ COMPONENTS @components@) | ||
| if(CMAKE_VERSION VERSION_GREATER_EQUAL 4.2.0) | ||
| find_package(@name@ @version@ QUIET UNWIND_INCLUDE COMPONENTS @components@) | ||
| __find_dependency_no_return(@name@ COMPONENTS @components@) | ||
| if(NOT @name@_FOUND) | ||
| unset(_cmake_unwind_arg) | ||
| return() | ||
| endif() | ||
| else | ||
| find_package(@name@ @version@ QUIET COMPONENTS @components@) | ||
| find_dependency(@name@ COMPONENTS @components@) | ||
| endif() |
13 changes: 11 additions & 2 deletions
13
rapids-cmake/export/template/install_package_versioned.cmake.in
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,11 @@ | ||
| find_package(@name@ @version@ QUIET) | ||
| find_dependency(@name@) | ||
| if(CMAKE_VERSION VERSION_GREATER_EQUAL 4.2.0) | ||
| find_package(@name@ @version@ QUIET UNWIND_INCLUDE) | ||
| __find_dependency_no_return(@name@) | ||
| if(NOT @name@_FOUND) | ||
| unset(_cmake_unwind_arg) | ||
| return() | ||
| endif() | ||
| else() | ||
| find_package(@name@ @version@ QUIET) | ||
| find_dependency(@name@) | ||
| endif() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
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.
I'm hesitant to sign off on using an undocumented command like this. How much assurance do we have that its interface won't change? Do we at least have a way to test that it's still working properly?
Uh oh!
There was an error while loading. Please reload this page.
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.
It's now used by CMake's own
EXPORT_PACKAGE_DEPENENCIES, so its no less stable than that.But
EXPORT_PACKAGE_DEPENDENCIESis still gated, so might change. I think it's reasonable for us to promote this to a non-underscore name within CMake.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.
It might be reasonable to accept this while 4.2.0 is still in the oven (4.1.0 is still in rc status), so it can get some "real-world" testing, and re-visit prior to 4.2.0 full release.
As I'm not sure what
__find_dependency_no_return's final form will be just yet.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.
I disagree. I worked on CMake long enough to know that even if the interface to
EXPORT_PACKAGE_DEPENDENCIESis stable, the underlying implementation details (which include this function) are not. If we're going to use an undocumented function in this manner, I want assurance that we have some sort of unit test that will tell us when the functionality is broken because the interface to the internal API changed.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.
Unfortunately, this won't work. The
masterbranch of CMake has version number4.1.20250804, and won't roll over to4.2until we get to4.2.0-rc1. If we want real-world testing before 4.2, we need to change the version number to4.1.20250804(or whatever nightly build introduced the internal function that we're using.)Uh oh!
There was an error while loading. Please reload this page.
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.
Our other option is to use
find_packageonly in our generated code. We would use${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIREDand${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLYto match the behavior offind_dependencybut wouldn't tie us to this undocumented functionThere 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.
That sounds reasonable to me.
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.
Because this function is exposed in generated export files that get shipped in downstream packages, we have an obligation to maintain whatever interface gets shipped once
EXPORT_PACKAGE_DEPENDENCIESgets out of experimental gate. If that happened today it would be__cmake_find_dependencies_no_return. I'm just not sure what it will be when the gate is actually removed.