[cmake] Make CCCL::CUB an IMPORTED target to allow downstream export#8330
Merged
alliepiper merged 1 commit intoNVIDIA:mainfrom Apr 9, 2026
Merged
[cmake] Make CCCL::CUB an IMPORTED target to allow downstream export#8330alliepiper merged 1 commit intoNVIDIA:mainfrom
alliepiper merged 1 commit intoNVIDIA:mainfrom
Conversation
Previously, CCCL::CUB was created as an ALIAS for the non-IMPORTED _CUB_CUB target. When downstream projects tried to install(EXPORT ...) a target that links to CCCL::CUB, CMake would resolve the alias and complain that _CUB_CUB was not in any export set: CMake Error: install(EXPORT "fooTargets" ...) includes target "foo" which requires target "_CUB_CUB" that is not in any export set. Fix this by creating CCCL::CUB as an INTERFACE IMPORTED GLOBAL target that links to CUB::CUB, mirroring the pattern already used by CCCL::Thrust (created via thrust_create_target as IMPORTED GLOBAL). Since CCCL::CUB is IMPORTED, CMake treats it as an external dependency and does not require it to be included in downstream export sets. Fixes NVIDIA#8069
Contributor
Contributor
Author
|
@bernhardmgruber could you help review this PR? thanks! |
Contributor
I think we need our cmake guru here. @alliepiper can you talk a look please? Thx! |
alliepiper
approved these changes
Apr 9, 2026
Contributor
alliepiper
left a comment
There was a problem hiding this comment.
LGTM -- Thanks for the PR!
Contributor
|
/ok to test e2cba75 |
Contributor
|
Those failures look unrelated, I'll look into them. |
Contributor
Author
OK, thank you! |
Contributor
🥳 CI Workflow Results🟩 Finished in 1h 33m: Pass: 100%/478 | Total: 7d 21h | Max: 1h 28m | Hits: 96%/555534See results here. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
closes #8069
When a downstream project links an interface library to
CCCL::CUBand then tries toinstall(EXPORT ...)it, CMake fails with:Root cause:
CCCL::CUBwas created as anALIASfor the non-IMPORTED internal target_CUB_CUB. When a target that links toCCCL::CUBis exported, CMake resolves the alias to_CUB_CUBand requires it to be in the export set—which it never is.Fix: Create
CCCL::CUBas anINTERFACE IMPORTED GLOBALtarget that links toCUB::CUB, mirroring the approach already used byCCCL::Thrust(whichthrust_create_targetcreates asIMPORTED GLOBAL). SinceCCCL::CUBisIMPORTED, CMake treats it as an external dependency and does not require it in downstream export sets.The include directories from
_CUB_CUBremain non-SYSTEM (nvcc treats include dirs as SYSTEM only forIMPORTEDtargets that have them set directly; here they remain on the non-IMPORTED_CUB_CUBtarget and are propagated transitively).Before / After:
Checklist