From b2078e21c4da5d9e28ef03d0f2eeb12585c96fa0 Mon Sep 17 00:00:00 2001 From: Carlos Zoido Date: Fri, 16 Oct 2026 13:32:32 +0200 Subject: [PATCH] initialize CPM and fetch icm only when they are needed --- CMakeLists.txt | 55 +++++++++++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b8a9cf1ea..6a6076530 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -106,7 +106,12 @@ endif() # * Dependencies ------------------------------------------------------------- # Initialize CPM -rapids_cpm_init(OVERRIDE ${CMAKE_CURRENT_SOURCE_DIR}/cmake/versions.json) +if(STDEXEC_BUILD_TESTS + OR STDEXEC_ENABLE_ASIO + OR STDEXEC_ENABLE_TASKFLOW + OR STDEXEC_ENABLE_CUDA) + rapids_cpm_init(OVERRIDE ${CMAKE_CURRENT_SOURCE_DIR}/cmake/versions.json) +endif() if(STDEXEC_BUILD_TESTS) # Add Catch2 @@ -126,31 +131,31 @@ if(STDEXEC_BUILD_TESTS) OPTIONS "CMAKE_CXX_STANDARD 20" "CATCH_CONFIG_NO_POSIX_SIGNALS ON") -endif() -# Add ICM -set(icm_VERSION 1.5.0) -# Always download it, don't attempt to do `find_package(ICM)` first -set(CPM_DOWNLOAD_icm TRUE) -rapids_cpm_find( - icm - ${icm_VERSION} - CPM_ARGS - GITHUB_REPOSITORY - iboB/icm - GIT_TAG - v${icm_VERSION} - VERSION - ${icm_VERSION} - PATCH_COMMAND - git - restore - -- - . - && - git - apply - ${CMAKE_CURRENT_LIST_DIR}/cmake/cpm/patches/icm/regex-build-error.diff) + # Add ICM + set(icm_VERSION 1.5.0) + # Always download it, don't attempt to do `find_package(ICM)` first + set(CPM_DOWNLOAD_icm TRUE) + rapids_cpm_find( + icm + ${icm_VERSION} + CPM_ARGS + GITHUB_REPOSITORY + iboB/icm + GIT_TAG + v${icm_VERSION} + VERSION + ${icm_VERSION} + PATCH_COMMAND + git + restore + -- + . + && + git + apply + ${CMAKE_CURRENT_LIST_DIR}/cmake/cpm/patches/icm/regex-build-error.diff) +endif() # Ensure that we link with the threading library set(CMAKE_THREAD_PREFER_PTHREAD TRUE)