Repository navigation
Initialize CPM and fetch icm only when they are needed - #2341
Merged
Merged
Conversation
This was referenced Oct 16, 2026
ericniebler
approved these changes
Oct 16, 2026
Collaborator
|
/ok to test b2078e2 |
Collaborator
|
thanks! |
|
Thanks for merging! |
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.
Hi! This came up while reviewing conan-io/conan-center-index#30060, which adds stdexec to ConanCenter. It's a first step for #2149 (cc @hollykbuck, who opened it and wrote that recipe). It keeps CPM out of the default configure, but doesn't change how the optional integrations get their dependencies.
Configuring stdexec always downloads
CPM.cmake(throughrapids_cpm_init) and clones icm, even when neither is used. Because of this, a plain configure and install fails without network access, which is how package managers usually build. vcpkg works around it by downloading CPM and icm ahead of time and patchingCMakeLists.txt, and the ConanCenter recipe would need a patch for the same reason.Changes
rapids_cpm_initnow runs only whenSTDEXEC_BUILD_TESTS,STDEXEC_ENABLE_ASIO,STDEXEC_ENABLE_TASKFLOWorSTDEXEC_ENABLE_CUDAis enabled. These are the only paths that use CPM (Catch2, icm, Asio, Taskflow and CCCL). The options are declared further down, but at this point they already hold any value passed with-Dor set by a parent project.if(STDEXEC_BUILD_TESTS)block, next to Catch2, since only the build-failure tests use it.With both changes, configuring with tests off only needs rapids-cmake, which packagers can provide through the standard
FETCHCONTENT_SOURCE_DIR_RAPIDS-CMAKEvariable. Nothing changes for developers, because tests are on by default when stdexec is the top-level project.Testing
On Ubuntu 24.04 (CMake 3.28.3, GCC 13), comparing
main(792e134) with this branch:CMakeCache.txtand the same CPM packagescmake --installFETCHCONTENT_SOURCE_DIR_RAPIDS-CMAKEmainfails inrapids_cpm_initwhile downloading CPM. This branch configures and installs, and also configures with examples onThe tests-off configure and install also work on macOS (Apple Clang 21, CMake 4.3.3).
Thanks a lot for considering this!