Skip to content

Commit 9ed0397

Browse files
fix(cmake): Replace deprecated FetchContent_Populate with FetchContent_MakeAvailable (#4309)
Update `source/lmp/plugin/CMakeLists.txt` to use `FetchContent_MakeAvailable` instead of `FetchContent_Populate`. * Replace `FetchContent_Populate(lammps_download)` with `FetchContent_MakeAvailable(lammps_download)` on line 13. * Remove `FetchContent_GetProperties` and `if(NOT lammps_download_POPULATED)` block. This fixes a CMake warning: ``` CMake Warning (dev) at /home/runner/work/_temp/-111029589/cmake-3.30.5-linux-x86_64/share/cmake-3.30/Modules/FetchContent.cmake:1953 (message): Calling FetchContent_Populate(lammps_download) is deprecated, call FetchContent_MakeAvailable(lammps_download) instead. Policy CMP0169 can be set to OLD to allow FetchContent_Populate(lammps_download) to be called directly for now, but the ability to call it with declared details will be removed completely in a future version. Call Stack (most recent call first): lmp/plugin/CMakeLists.txt:13 (FetchContent_Populate) This warning is for project developers. Use -Wno-dev to suppress it. ``` --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/njzjz/deepmd-kit?shareId=32a460fb-6c67-4397-b000-6f36e9841970). <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Chores** - Simplified CMake configuration for the LAMMPS plugin, ensuring consistent availability of LAMMPS source. - Streamlined handling of LAMMPS versioning and installation logic. - Updated minimum required CMake version from 3.11 to 3.14. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 4b73fbe commit 9ed0397

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

source/lmp/plugin/CMakeLists.txt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,14 @@ if(DEFINED LAMMPS_SOURCE_ROOT OR DEFINED LAMMPS_VERSION)
22
message(STATUS "enable LAMMPS plugin mode")
33
add_library(lammps_interface INTERFACE)
44
if(DEFINED LAMMPS_VERSION)
5-
cmake_minimum_required(VERSION 3.11)
5+
cmake_minimum_required(VERSION 3.14)
66
include(FetchContent)
77
FetchContent_Declare(
88
lammps_download
99
GIT_REPOSITORY https://github.com/lammps/lammps
1010
GIT_TAG ${LAMMPS_VERSION})
11-
FetchContent_GetProperties(lammps_download)
12-
if(NOT lammps_download_POPULATED)
13-
FetchContent_Populate(lammps_download)
14-
set(LAMMPS_SOURCE_ROOT ${lammps_download_SOURCE_DIR})
15-
endif()
11+
FetchContent_MakeAvailable(lammps_download)
12+
set(LAMMPS_SOURCE_ROOT ${lammps_download_SOURCE_DIR})
1613
endif()
1714
set(LAMMPS_HEADER_DIR ${LAMMPS_SOURCE_ROOT}/src)
1815
message(STATUS "LAMMPS_HEADER_DIR is ${LAMMPS_HEADER_DIR}")

0 commit comments

Comments
 (0)