From 5e1bddd825062cfee99c3ce944a1971a19e3f271 Mon Sep 17 00:00:00 2001 From: FeignClaims Date: Sun, 1 Sep 2024 00:21:56 +0800 Subject: [PATCH] fix(cmake): Replace deprecated `FetchContent_Populate` --- src/CrossCompiler.cmake | 8 +++++--- src/PackageProject.cmake | 14 +++++++++----- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/CrossCompiler.cmake b/src/CrossCompiler.cmake index 0b99ac5e..3d74d29a 100644 --- a/src/CrossCompiler.cmake +++ b/src/CrossCompiler.cmake @@ -357,11 +357,13 @@ macro(enable_cross_compiler) if(NOT DEFINED EMSCRIPTEN_ROOT) include(FetchContent) message(STATUS "fetch emscripten repo main branch. ...") - FetchContent_Declare( - emscripten GIT_REPOSITORY https://github.com/emscripten-core/emscripten GIT_TAG main + FetchContent_Declare(emscripten + GIT_REPOSITORY https://github.com/emscripten-core/emscripten + GIT_TAG main + SOURCE_SUBDIR this-directory-does-not-exist ) if(NOT emscripten_POPULATED) - FetchContent_Populate(emscripten) + FetchContent_MakeAvailable(emscripten) set(EMSCRIPTEN_ROOT "${emscripten_SOURCE_DIR}") endif() endif() diff --git a/src/PackageProject.cmake b/src/PackageProject.cmake index eab21f37..186a8f19 100644 --- a/src/PackageProject.cmake +++ b/src/PackageProject.cmake @@ -266,12 +266,13 @@ function(package_project) ) # download ForwardArguments - FetchContent_Declare( - _fargs URL https://github.com/polysquare/cmake-forward-arguments/archive/refs/tags/v1.0.0.zip + FetchContent_Declare(_fargs + URL https://github.com/polysquare/cmake-forward-arguments/archive/refs/tags/v1.0.0.zip + SOURCE_SUBDIR this-directory-does-not-exist ) FetchContent_GetProperties(_fargs) if(NOT _fargs_POPULATED) - FetchContent_Populate(_fargs) + FetchContent_MakeAvailable(_fargs) endif() include("${_fargs_SOURCE_DIR}/ForwardArguments.cmake") @@ -289,10 +290,13 @@ function(package_project) ) # download ycm - FetchContent_Declare(_ycm URL https://github.com/robotology/ycm/archive/refs/tags/v0.13.0.zip) + FetchContent_Declare(_ycm + URL https://github.com/robotology/ycm/archive/refs/tags/v0.13.0.zip + SOURCE_SUBDIR this-directory-does-not-exist + ) FetchContent_GetProperties(_ycm) if(NOT _ycm_POPULATED) - FetchContent_Populate(_ycm) + FetchContent_MakeAvailable(_ycm) endif() include("${_ycm_SOURCE_DIR}/modules/InstallBasicPackageFiles.cmake")