Skip to content

Initialize CPM and fetch icm only when they are needed - #2341

Merged
ericniebler merged 1 commit into
NVIDIA:mainfrom
czoido:cpm-only-when-needed
Oct 16, 2026
Merged

ericniebler merged 1 commit into
NVIDIA:mainfrom
czoido:cpm-only-when-needed

Conversation

@czoido

@czoido czoido commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

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 (through rapids_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 patching CMakeLists.txt, and the ConanCenter recipe would need a patch for the same reason.

Changes

  • rapids_cpm_init now runs only when STDEXEC_BUILD_TESTS, STDEXEC_ENABLE_ASIO, STDEXEC_ENABLE_TASKFLOW or STDEXEC_ENABLE_CUDA is 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 -D or set by a parent project.
  • The icm fetch moves into the existing 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-CMAKE variable. 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:

Configuration Network Result
Default top-level configure (tests and examples on) yes Identical build system: the same 597 targets, the same 13 CTest tests registered at configure time, an identical CMakeCache.txt and the same CPM packages
Tests and examples off, then cmake --install yes Identical install tree (182 files)
Tests off, with Taskflow or standalone Asio enabled yes Configures, and CPM adds the integration
Tests off, rapids-cmake from FETCHCONTENT_SOURCE_DIR_RAPIDS-CMAKE no main fails in rapids_cpm_init while downloading CPM. This branch configures and installs, and also configures with examples on

The tests-off configure and install also work on macOS (Apple Clang 21, CMake 4.3.3).

Thanks a lot for considering this!

@copy-pr-bot

copy-pr-bot Bot commented Oct 16, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@ericniebler

Copy link
Copy Markdown
Collaborator

/ok to test b2078e2

@ericniebler
ericniebler merged commit 34fa947 into NVIDIA:main Oct 16, 2026
40 checks passed
@ericniebler

Copy link
Copy Markdown
Collaborator

thanks!

@junghans

Copy link
Copy Markdown

Thanks for merging!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants