Commit d244f9e
fix: bump CMake minimum version to 3.25.2 (#5001)
## 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 #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
>
> #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 #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>1 parent 54dae2f commit d244f9e
10 files changed
Lines changed: 19 additions & 19 deletions
File tree
- backend
- doc/install
- examples/infer_water
- source
- api_cc/tests
- api_c/tests
- lib
- src/gpu
- tests
- lmp/plugin
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
377 | 377 | | |
378 | 378 | | |
379 | 379 | | |
380 | | - | |
| 380 | + | |
381 | 381 | | |
382 | 382 | | |
383 | 383 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
283 | 283 | | |
284 | 284 | | |
285 | 285 | | |
286 | | - | |
287 | | - | |
288 | | - | |
| 286 | + | |
| 287 | + | |
289 | 288 | | |
290 | 289 | | |
291 | 290 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
| 1 | + | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
247 | | - | |
| 247 | + | |
248 | 248 | | |
249 | 249 | | |
250 | 250 | | |
| |||
261 | 261 | | |
262 | 262 | | |
263 | 263 | | |
264 | | - | |
| 264 | + | |
265 | 265 | | |
266 | 266 | | |
267 | 267 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
57 | | - | |
| 58 | + | |
58 | 59 | | |
59 | 60 | | |
60 | 61 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
0 commit comments