Skip to content

Commit

Permalink
CMake: Replace FetchContent_Populate
Browse files Browse the repository at this point in the history
In CMake superbuilds, `FetchContent_Populate` is now deprecated.
Use `FetchContent_MakeAvailable` instead.
  • Loading branch information
ax3l committed Aug 30, 2024
1 parent 608c2aa commit e486292
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 34 deletions.
22 changes: 8 additions & 14 deletions ExampleCodes/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,13 @@ if( NOT DEFINED AMReX_DIR )
GIT_TAG ${AMReX_GIT_BRANCH}
)

if(NOT ${amrex}_POPULATED)
FetchContent_Populate(amrex)
FetchContent_MakeAvailable(amrex)

list(APPEND CMAKE_MODULE_PATH ${amrex_SOURCE_DIR}/Tools/CMake)
list(APPEND CMAKE_MODULE_PATH ${amrex_SOURCE_DIR}/Tools/CMake)

# Load amrex options here so that they are
# available to the entire project
include(AMReXOptions)
# Load amrex options here so that they are
# available to the entire project
include(AMReXOptions)

if( AMReX_SUNDIALS )
if( NOT DEFINED SUNDIALS_DIR )
Expand All @@ -85,8 +84,7 @@ if( NOT DEFINED SUNDIALS_DIR )
GIT_TAG ${SUNDIALS_GIT_BRANCH}
)

if(NOT ${sundials}_POPULATED)
FetchContent_Populate(sundials)
FetchContent_MakeAvailable(sundials)
# set(SUNDIALS_DIR ${sundials_SOURCE_DIR})
# Set build options for subproject
set(EXAMPLES_ENABLE_C OFF CACHE INTERNAL "" )
Expand Down Expand Up @@ -119,7 +117,7 @@ if( NOT DEFINED SUNDIALS_DIR )
set(BUILD_IDA OFF CACHE INTERNAL "" )
set(BUILD_IDAS OFF CACHE INTERNAL "" )
set(BUILD_CVODES OFF CACHE INTERNAL "" )
endif ()

list(APPEND CMAKE_MODULE_PATH ${sundials_SOURCE_DIR})

# Add SUNDIALS sources to the build
Expand Down Expand Up @@ -159,7 +157,6 @@ else ()
endif ()

set(SUNDIALS_FOUND TRUE)
endif ()
endif ()
if(AMReX_FORTRAN)
enable_language(Fortran)
Expand Down Expand Up @@ -211,10 +208,7 @@ if(TUTORIAL_PYTHON)
GIT_TAG ${pyAMReX_GIT_BRANCH}
)

if(NOT fetchedpyamrex_POPULATED)
FetchContent_Populate(fetchedpyamrex)
add_subdirectory(${fetchedpyamrex_SOURCE_DIR} ${fetchedpyamrex_BINARY_DIR})
endif()
FetchContent_MakeAvailable(fetchedpyamrex)
endif()
endif()

Expand Down
6 changes: 1 addition & 5 deletions GuidedTutorials/HeatEquation/Exec/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,7 @@ if(NOT DEFINED AMReX_ROOT)
GIT_TAG origin/development
)

FetchContent_Populate(amrex_code)

# CMake will read the files in these directories and configure, build
# and install AMReX.
add_subdirectory(${amrex_code_SOURCE_DIR} ${amrex_code_BINARY_DIR})
FetchContent_MakeAvailable(amrex_code)

else()

Expand Down
6 changes: 1 addition & 5 deletions GuidedTutorials/HeatEquation_Simple/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,7 @@ if(NOT DEFINED AMReX_ROOT)
GIT_TAG origin/development
)

FetchContent_Populate(amrex_code)

# CMake will read the files in these directories to configure, build
# and install AMReX.
add_subdirectory(${amrex_code_SOURCE_DIR} ${amrex_code_BINARY_DIR})
FetchContent_MakeAvailable(amrex_code)

else()

Expand Down
6 changes: 1 addition & 5 deletions GuidedTutorials/HelloWorld/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,7 @@ if(NOT DEFINED AMReX_ROOT)
GIT_TAG origin/development
)

FetchContent_Populate(amrex_code)

# CMake will read the files in these directories and configure, build
# and install AMReX.
add_subdirectory(${amrex_code_SOURCE_DIR} ${amrex_code_BINARY_DIR})
FetchContent_MakeAvailable(amrex_code)

else()

Expand Down
6 changes: 1 addition & 5 deletions GuidedTutorials/MultiFab/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,7 @@ if(NOT DEFINED AMReX_ROOT)
GIT_TAG origin/development
)

FetchContent_Populate(amrex_code)

# CMake will read the files in these directories and configure, build
# and install AMReX.
add_subdirectory(${amrex_code_SOURCE_DIR} ${amrex_code_BINARY_DIR})
FetchContent_MakeAvailable(amrex_code)

else()

Expand Down

0 comments on commit e486292

Please sign in to comment.