Skip to content

Commit 5e1bddd

Browse files
committed
fix(cmake): Replace deprecated FetchContent_Populate
1 parent 6df0ec6 commit 5e1bddd

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

src/CrossCompiler.cmake

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -357,11 +357,13 @@ macro(enable_cross_compiler)
357357
if(NOT DEFINED EMSCRIPTEN_ROOT)
358358
include(FetchContent)
359359
message(STATUS "fetch emscripten repo main branch. ...")
360-
FetchContent_Declare(
361-
emscripten GIT_REPOSITORY https://github.com/emscripten-core/emscripten GIT_TAG main
360+
FetchContent_Declare(emscripten
361+
GIT_REPOSITORY https://github.com/emscripten-core/emscripten
362+
GIT_TAG main
363+
SOURCE_SUBDIR this-directory-does-not-exist
362364
)
363365
if(NOT emscripten_POPULATED)
364-
FetchContent_Populate(emscripten)
366+
FetchContent_MakeAvailable(emscripten)
365367
set(EMSCRIPTEN_ROOT "${emscripten_SOURCE_DIR}")
366368
endif()
367369
endif()

src/PackageProject.cmake

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -266,12 +266,13 @@ function(package_project)
266266
)
267267

268268
# download ForwardArguments
269-
FetchContent_Declare(
270-
_fargs URL https://github.com/polysquare/cmake-forward-arguments/archive/refs/tags/v1.0.0.zip
269+
FetchContent_Declare(_fargs
270+
URL https://github.com/polysquare/cmake-forward-arguments/archive/refs/tags/v1.0.0.zip
271+
SOURCE_SUBDIR this-directory-does-not-exist
271272
)
272273
FetchContent_GetProperties(_fargs)
273274
if(NOT _fargs_POPULATED)
274-
FetchContent_Populate(_fargs)
275+
FetchContent_MakeAvailable(_fargs)
275276
endif()
276277
include("${_fargs_SOURCE_DIR}/ForwardArguments.cmake")
277278

@@ -289,10 +290,13 @@ function(package_project)
289290
)
290291

291292
# download ycm
292-
FetchContent_Declare(_ycm URL https://github.com/robotology/ycm/archive/refs/tags/v0.13.0.zip)
293+
FetchContent_Declare(_ycm
294+
URL https://github.com/robotology/ycm/archive/refs/tags/v0.13.0.zip
295+
SOURCE_SUBDIR this-directory-does-not-exist
296+
)
293297
FetchContent_GetProperties(_ycm)
294298
if(NOT _ycm_POPULATED)
295-
FetchContent_Populate(_ycm)
299+
FetchContent_MakeAvailable(_ycm)
296300
endif()
297301
include("${_ycm_SOURCE_DIR}/modules/InstallBasicPackageFiles.cmake")
298302

0 commit comments

Comments
 (0)