CMake CMP0169: FetchContent_Populate is deprecated, call FetchContent_MakeAvailable instead
Summary
Since CMake 3.30, FetchContent_Populate
is deprecated in favor of FetchContent_MakeAvailable
.
Exact steps to reproduce
Try building GROMACS with CMake 3.30, observe the following warning:
CMake Warning (dev) at /usr/share/cmake-3.30/Modules/FetchContent.cmake:1953 (message):
Calling FetchContent_Populate(muparser) is deprecated, call
FetchContent_MakeAvailable(muparser) instead. Policy CMP0169 can be set to
OLD to allow FetchContent_Populate(muparser) 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):
cmake/gmxManageMuparser.cmake:59 (FetchContent_Populate)
src/gromacs/CMakeLists.txt:69 (gmx_manage_muparser)
This warning is for project developers. Use -Wno-dev to suppress it.
In some cases, it is even a fatal error: https://gromacs.bioexcel.eu/t/cmake-error-at-usr-local-share-cmake-3-30-modules-fetchcontent-cmake-1951-message/10117
For developers: Why is this important?
We don't need extra CMake warnings.
Possible fixes
- 2024: set the policy to old
- 2025: use
FetchContent_MakeAvailable