Skip to content

do not use FetchContent_Populate in CMake >= 3.28 #1300

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

Merged
merged 1 commit into from
May 9, 2025

Conversation

bratpiorka
Copy link
Contributor

@bratpiorka bratpiorka commented May 8, 2025

Starting with CMake 3.30, FetchContent_Populate is deprecated. It can be replaced by FetchContent_Declare(... EXCLUDE_FROM_ALL) + FetchContent_MakeAvailable(). However, the EXCLUDE_FROM_ALL flag is available only from CMake 3.28

This pull request checks the CMake version, and for versions <= 3.28, we use FetchContent_Populate, and for later versions, we use EXCLUDE_FROM_ALL + FetchContent_MakeAvailable.

example logs with different CMake versions:

CMake 3.14.0
https://github.com/oneapi-src/unified-memory-framework/actions/runs/14906699261/job/41871908648?pr=1300

CMake 3.29.0
https://github.com/oneapi-src/unified-memory-framework/actions/runs/14906699261/job/41871908635?pr=1300

CMake latest (3.31.6)
https://github.com/oneapi-src/unified-memory-framework/actions/runs/14906699261/job/41871908632?pr=1300

fixes #971

@bratpiorka bratpiorka force-pushed the rrudnick_fix_populate branch 6 times, most recently from 66719aa to ab67de5 Compare May 8, 2025 13:45
@bratpiorka bratpiorka changed the title TODO fix populate warning do not use FetchContent_Populate in CMake > 3.28 May 8, 2025
@bratpiorka bratpiorka marked this pull request as ready for review May 8, 2025 13:56
@bratpiorka bratpiorka requested a review from a team as a code owner May 8, 2025 13:56
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adapts the build pipeline to account for deprecation of FetchContent_Populate by selecting the appropriate CMake commands based on the version.

  • Remove the "Check spelling in docs" step from the spelling checks.
  • Update the CMake version in the reusable_basic workflow to use a specific version (3.29.0) instead of "latest".

Reviewed Changes

Copilot reviewed 2 out of 4 changed files in this pull request and generated no comments.

File Description
.github/workflows/reusable_checks.yml Removed the docs spelling check step, potentially affecting documentation quality validation.
.github/workflows/reusable_basic.yml Updated the CMake version to 3.29.0 and renamed the install step accordingly.
Files not reviewed (2)
  • CMakeLists.txt: Language not supported
  • examples/cuda_shared_memory/CMakeLists.txt: Language not supported

@lukaszstolarczuk lukaszstolarczuk changed the title do not use FetchContent_Populate in CMake > 3.28 do not use FetchContent_Populate in CMake >= 3.28 May 8, 2025
@bratpiorka bratpiorka force-pushed the rrudnick_fix_populate branch 3 times, most recently from c860665 to b551fcf Compare May 9, 2025 06:37
@lukaszstolarczuk lukaszstolarczuk merged commit 3392550 into oneapi-src:main May 9, 2025
169 of 170 checks passed
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.

cmake --install . --prefix <some_path> failed in some cases
3 participants