Skip to content

Commit 2dfd180

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

File tree

5 files changed

+12
-36
lines changed

5 files changed

+12
-36
lines changed

ExampleCodes/CMakeLists.txt

+8-16
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 "" )
@@ -122,9 +122,6 @@ if( NOT DEFINED SUNDIALS_DIR )
122122
endif ()
123123
list(APPEND CMAKE_MODULE_PATH ${sundials_SOURCE_DIR})
124124

125-
# Add SUNDIALS sources to the build
126-
add_subdirectory(${sundials_SOURCE_DIR})
127-
128125
# This is to use the same target name uses by the sundials exported targets
129126
add_library(SUNDIALS::cvode ALIAS sundials_cvode_static)
130127
add_library(SUNDIALS::arkode ALIAS sundials_arkode_static)
@@ -172,9 +169,6 @@ endif ()
172169
include(AMReX_SetupCUDA)
173170
endif()
174171
endif()
175-
176-
# Bring the populated content into the build
177-
add_subdirectory(${amrex_SOURCE_DIR} ${amrex_BINARY_DIR})
178172
endif()
179173
else()
180174
message(STATUS "Using existing AMReX library")
@@ -210,10 +204,8 @@ if(TUTORIAL_PYTHON)
210204
GIT_REPOSITORY ${pyAMReX_GIT_REPO}
211205
GIT_TAG ${pyAMReX_GIT_BRANCH}
212206
)
213-
214207
if(NOT fetchedpyamrex_POPULATED)
215-
FetchContent_Populate(fetchedpyamrex)
216-
add_subdirectory(${fetchedpyamrex_SOURCE_DIR} ${fetchedpyamrex_BINARY_DIR})
208+
FetchContent_MakeAvailable(fetchedpyamrex)
217209
endif()
218210
endif()
219211
endif()

GuidedTutorials/HeatEquation/Exec/CMakeLists.txt

+1-5
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

+1-5
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

+1-5
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

+1-5
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)