Skip to content

Commit 2b23d48

Browse files
committed
CMake: Replace FetchContent_Populate
In CMake superbuilds, `FetchContent_Populate` is now deprecated. Use `FetchContent_MakeAvailable` instead.
1 parent 608c2aa commit 2b23d48

File tree

5 files changed

+12
-33
lines changed

5 files changed

+12
-33
lines changed

ExampleCodes/CMakeLists.txt

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,14 @@ if( NOT DEFINED AMReX_DIR )
5959
GIT_TAG ${AMReX_GIT_BRANCH}
6060
)
6161

62-
if(NOT ${amrex}_POPULATED)
63-
FetchContent_Populate(amrex)
62+
if(NOT ${amrex}_POPULATED)
63+
FetchContent_MakeAvailable(amrex)
6464

65-
list(APPEND CMAKE_MODULE_PATH ${amrex_SOURCE_DIR}/Tools/CMake)
65+
list(APPEND CMAKE_MODULE_PATH ${amrex_SOURCE_DIR}/Tools/CMake)
6666

67-
# Load amrex options here so that they are
68-
# available to the entire project
69-
include(AMReXOptions)
67+
# Load amrex options here so that they are
68+
# available to the entire project
69+
include(AMReXOptions)
7070

7171
if( AMReX_SUNDIALS )
7272
if( NOT DEFINED SUNDIALS_DIR )
@@ -86,7 +86,7 @@ if( NOT DEFINED SUNDIALS_DIR )
8686
)
8787

8888
if(NOT ${sundials}_POPULATED)
89-
FetchContent_Populate(sundials)
89+
FetchContent_MakeAvailable(sundials)
9090
# set(SUNDIALS_DIR ${sundials_SOURCE_DIR})
9191
# Set build options for subproject
9292
set(EXAMPLES_ENABLE_C OFF CACHE INTERNAL "" )
@@ -172,9 +172,6 @@ endif ()
172172
include(AMReX_SetupCUDA)
173173
endif()
174174
endif()
175-
176-
# Bring the populated content into the build
177-
add_subdirectory(${amrex_SOURCE_DIR} ${amrex_BINARY_DIR})
178175
endif()
179176
else()
180177
message(STATUS "Using existing AMReX library")
@@ -210,10 +207,8 @@ if(TUTORIAL_PYTHON)
210207
GIT_REPOSITORY ${pyAMReX_GIT_REPO}
211208
GIT_TAG ${pyAMReX_GIT_BRANCH}
212209
)
213-
214210
if(NOT fetchedpyamrex_POPULATED)
215-
FetchContent_Populate(fetchedpyamrex)
216-
add_subdirectory(${fetchedpyamrex_SOURCE_DIR} ${fetchedpyamrex_BINARY_DIR})
211+
FetchContent_MakeAvailable(fetchedpyamrex)
217212
endif()
218213
endif()
219214
endif()

GuidedTutorials/HeatEquation/Exec/CMakeLists.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,7 @@ if(NOT DEFINED AMReX_ROOT)
5757
GIT_TAG origin/development
5858
)
5959

60-
FetchContent_Populate(amrex_code)
61-
62-
# CMake will read the files in these directories and configure, build
63-
# and install AMReX.
64-
add_subdirectory(${amrex_code_SOURCE_DIR} ${amrex_code_BINARY_DIR})
60+
FetchContent_MakeAvailable(amrex_code)
6561

6662
else()
6763

GuidedTutorials/HeatEquation_Simple/CMakeLists.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,7 @@ if(NOT DEFINED AMReX_ROOT)
4949
GIT_TAG origin/development
5050
)
5151

52-
FetchContent_Populate(amrex_code)
53-
54-
# CMake will read the files in these directories to configure, build
55-
# and install AMReX.
56-
add_subdirectory(${amrex_code_SOURCE_DIR} ${amrex_code_BINARY_DIR})
52+
FetchContent_MakeAvailable(amrex_code)
5753

5854
else()
5955

GuidedTutorials/HelloWorld/CMakeLists.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,7 @@ if(NOT DEFINED AMReX_ROOT)
5353
GIT_TAG origin/development
5454
)
5555

56-
FetchContent_Populate(amrex_code)
57-
58-
# CMake will read the files in these directories and configure, build
59-
# and install AMReX.
60-
add_subdirectory(${amrex_code_SOURCE_DIR} ${amrex_code_BINARY_DIR})
56+
FetchContent_MakeAvailable(amrex_code)
6157

6258
else()
6359

GuidedTutorials/MultiFab/CMakeLists.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,7 @@ if(NOT DEFINED AMReX_ROOT)
5353
GIT_TAG origin/development
5454
)
5555

56-
FetchContent_Populate(amrex_code)
57-
58-
# CMake will read the files in these directories and configure, build
59-
# and install AMReX.
60-
add_subdirectory(${amrex_code_SOURCE_DIR} ${amrex_code_BINARY_DIR})
56+
FetchContent_MakeAvailable(amrex_code)
6157

6258
else()
6359

0 commit comments

Comments
 (0)