fix: bump CMake minimum version to 3.25.2#5001
Merged
wanghan-iapcm merged 4 commits intodevelfrom Oct 2, 2025
Merged
Conversation
Update CMake minimum required version from 3.16 to 3.25 to support RUN_OUTPUT_STDOUT_VARIABLE used in Findtensorflow.cmake. Changes: - Updated source/CMakeLists.txt main requirement - Updated backend/read_env.py for all variants (cpu, cuda, rocm) - Updated documentation in doc/install/install-from-source.md - Updated GPU-specific CMakeLists.txt files - Updated test CMakeLists.txt files - Updated example CMakeLists.txt file Fixes issue where RUN_OUTPUT_STDOUT_VARIABLE (new in CMake 3.25) was being used while minimum version was set to 3.16. Co-authored-by: njzjz <9496702+njzjz@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] [BUG] CMake minimal version should be bumped to 3.25
feat: bump CMake minimum version to 3.25
Oct 1, 2025
njzjz
approved these changes
Oct 1, 2025
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR updates the CMake minimum required version from 3.16 to 3.25 across the repository to support the RUN_OUTPUT_STDOUT_VARIABLE option used in the TensorFlow finder module, which was introduced in PR #4890.
- Standardizes CMake version requirement to 3.25 for all build variants (CPU, CUDA, ROCM)
- Updates build configuration files, test directories, and examples consistently
- Simplifies documentation to reflect the unified version requirement
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| source/CMakeLists.txt | Updated main CMake requirement and variant-specific requirements |
| backend/read_env.py | Updated version requirements for all build variants in Python configuration |
| doc/install/install-from-source.md | Simplified documentation to reflect unified 3.25 requirement |
| source/lib/src/gpu/CMakeLists.txt | Updated GPU library CMake requirements with clarified comments |
| source/lib/tests/CMakeLists.txt | Updated test directory CMake requirement |
| source/api_c/tests/CMakeLists.txt | Updated C API test CMake requirement |
| source/api_cc/tests/CMakeLists.txt | Updated C++ API test CMake requirement |
| source/lmp/plugin/CMakeLists.txt | Updated LAMMPS plugin CMake requirement |
| examples/infer_water/CMakeLists.txt | Updated example project CMake requirement |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## devel #5001 +/- ##
==========================================
- Coverage 84.29% 84.28% -0.02%
==========================================
Files 708 708
Lines 69899 69910 +11
Branches 3605 3607 +2
==========================================
Hits 58922 58922
- Misses 9820 9831 +11
Partials 1157 1157 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
njzjz
reviewed
Oct 1, 2025
CMake 3.25.0 and 3.25.1 contain a bug (https://gitlab.kitware.com/cmake/cmake/-/issues/24275), so the minimum version is updated to 3.25.2. Co-authored-by: njzjz <9496702+njzjz@users.noreply.github.com>
Copilot
AI
changed the title
fix: bump CMake minimum version to 3.25
fix: bump CMake minimum version to 3.25.2
Oct 1, 2025
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@ustc.edu.cn>
njzjz
approved these changes
Oct 1, 2025
wanghan-iapcm
approved these changes
Oct 2, 2025
ChiahsinChu
pushed a commit
to ChiahsinChu/deepmd-kit
that referenced
this pull request
Dec 17, 2025
## Summary This PR bumps the CMake minimum required version from 3.16 to 3.25.2 across the repository to support the `RUN_OUTPUT_STDOUT_VARIABLE` option used in `source/cmake/Findtensorflow.cmake`. ## Background PR deepmodeling#4890 introduced the use of `RUN_OUTPUT_STDOUT_VARIABLE` in the `try_run()` command within `source/cmake/Findtensorflow.cmake` (line 297). This CMake feature was added in CMake 3.25, but the minimum required version was still set to 3.16, which would cause build failures on systems with older CMake versions. Additionally, CMake 3.25.0 and 3.25.1 contain a bug (https://gitlab.kitware.com/cmake/cmake/-/issues/24275), so the minimum version is set to 3.25.2 to avoid this issue. ## Changes This PR updates the CMake version requirements consistently across all build configuration files: - **Main CMakeLists.txt**: Updated base requirement and conditional requirements for CUDA/ROCM variants - **Python build configuration** (`backend/read_env.py`): Updated version requirements for CPU, CUDA, and ROCM variants - **Documentation** (`doc/install/install-from-source.md`): Simplified to state that CMake 3.25.2+ is required for all platforms - **Test and example CMakeLists**: Updated all test directories and example projects to require CMake 3.25.2 for consistency ### Files Modified - `source/CMakeLists.txt` - `backend/read_env.py` - `doc/install/install-from-source.md` - `source/lib/src/gpu/CMakeLists.txt` - `source/lib/tests/CMakeLists.txt` - `source/api_c/tests/CMakeLists.txt` - `source/api_cc/tests/CMakeLists.txt` - `source/lmp/plugin/CMakeLists.txt` - `examples/infer_water/CMakeLists.txt` ## Impact Users will need CMake 3.25.2 or later to build DeePMD-kit from source. CMake 3.25.2 was released in March 2022, so it should be widely available. Users can easily install or upgrade CMake via pip: ```bash pip install -U cmake ``` Fixes the issue where builds would fail with CMake versions between 3.16 and 3.24 due to the use of `RUN_OUTPUT_STDOUT_VARIABLE`, and avoids the bug present in CMake 3.25.0 and 3.25.1. <!-- START COPILOT CODING AGENT SUFFIX --> <details> <summary>Original prompt</summary> > > ---- > > *This section details on the original issue you should resolve* > > <issue_title>[BUG] CMake minimal version should be bumped to 3.25</issue_title> > <issue_description>### Bug summary > > deepmodeling#4890 uses `RUN_OUTPUT_STDOUT_VARIABLE` which is new in CMake 3.25. Thus, the CMake minimal version should be bumped to 3.25 in CMakeLists.txt, read_env.py, and the documentation. > > ### DeePMD-kit Version > > devel > > ### Backend and its version > > - > > ### How did you download the software? > > Built from source > > ### Input Files, Running Commands, Error Log, etc. > > As above. > > ### Steps to Reproduce > > As above. > > ### Further Information, Files, and Links > > _No response_</issue_description> > > ## Comments on the Issue (you are @copilot in this section) > > <comments> > </comments> > </details> Fixes deepmodeling#5000 <!-- START COPILOT CODING AGENT TIPS --> --- 💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click [here](https://survey3.medallia.com/?EAHeSx-AP01bZqG0Ld9QLQ) to start the survey. --------- Signed-off-by: Jinzhe Zeng <jinzhe.zeng@ustc.edu.cn> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: njzjz <9496702+njzjz@users.noreply.github.com> Co-authored-by: Jinzhe Zeng <jinzhe.zeng@ustc.edu.cn>
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.
Summary
This PR bumps the CMake minimum required version from 3.16 to 3.25.2 across the repository to support the
RUN_OUTPUT_STDOUT_VARIABLEoption used insource/cmake/Findtensorflow.cmake.Background
PR #4890 introduced the use of
RUN_OUTPUT_STDOUT_VARIABLEin thetry_run()command withinsource/cmake/Findtensorflow.cmake(line 297). This CMake feature was added in CMake 3.25, but the minimum required version was still set to 3.16, which would cause build failures on systems with older CMake versions.Additionally, CMake 3.25.0 and 3.25.1 contain a bug (https://gitlab.kitware.com/cmake/cmake/-/issues/24275), so the minimum version is set to 3.25.2 to avoid this issue.
Changes
This PR updates the CMake version requirements consistently across all build configuration files:
backend/read_env.py): Updated version requirements for CPU, CUDA, and ROCM variantsdoc/install/install-from-source.md): Simplified to state that CMake 3.25.2+ is required for all platformsFiles Modified
source/CMakeLists.txtbackend/read_env.pydoc/install/install-from-source.mdsource/lib/src/gpu/CMakeLists.txtsource/lib/tests/CMakeLists.txtsource/api_c/tests/CMakeLists.txtsource/api_cc/tests/CMakeLists.txtsource/lmp/plugin/CMakeLists.txtexamples/infer_water/CMakeLists.txtImpact
Users will need CMake 3.25.2 or later to build DeePMD-kit from source. CMake 3.25.2 was released in March 2022, so it should be widely available. Users can easily install or upgrade CMake via pip:
Fixes the issue where builds would fail with CMake versions between 3.16 and 3.24 due to the use of
RUN_OUTPUT_STDOUT_VARIABLE, and avoids the bug present in CMake 3.25.0 and 3.25.1.Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.