After upgrading to CMake 3.30, this fine wrapper function …
function(fetch_and_extract_archive dst_name url checksum)
cmake_parse_arguments(ARG "POPULATE_ONLY" "" "" "${ARGN}")
FetchContent_Declare("${dst_name}" URL ${url} URL_HASH "${checksum}")
if(ARG_POPULATE_ONLY)
if(NOT ${dst_name}_POPULATED)
FetchContent_Populate(${dst_name})
endif()
else()
FetchContent_MakeAvailable(${dst_name})
endif()
set("${dst_name}_SOURCE_DIR" "${CMAKE_BINARY_DIR}/_deps/${dst_name}-src" PARENT_SCOPE)
endfunction()
… turned into this build error:
CMake Error (dev) at /usr/share/cmake/Modules/FetchContent.cmake:1953 (message):
Calling FetchContent_Populate() is deprecated, call
FetchContent_MakeAvailable() instead. Policy CMP0169 can be
set to OLD to allow FetchContent_Populate() 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):
…
This error is for project developers. Use -Wno-error=dev to suppress it.
Obviously, I’m trying to not use the extracted CMakeLists.txt, which is why using MakeAvailable instead is not an option.