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 27, 2024
1 parent 6061d62 commit 337afa6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 17 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Preamble ####################################################################
#
cmake_minimum_required(VERSION 3.20.0)
cmake_minimum_required(VERSION 3.24.0)
project(pyAMReX VERSION 24.08)

include(${pyAMReX_SOURCE_DIR}/cmake/pyAMReXFunctions.cmake)
Expand Down
15 changes: 5 additions & 10 deletions cmake/dependencies/AMReX.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,16 @@ macro(find_amrex)
endif()
add_subdirectory(${pyAMReX_amrex_src} _deps/localamrex-build/)
else()
if(AMReX_GPU_BACKEND STREQUAL CUDA)
enable_language(CUDA)
endif()
FetchContent_Declare(fetchedamrex
GIT_REPOSITORY ${pyAMReX_amrex_repo}
GIT_TAG ${pyAMReX_amrex_branch}
BUILD_IN_SOURCE 0
)
FetchContent_GetProperties(fetchedamrex)

if(NOT fetchedamrex_POPULATED)
FetchContent_Populate(fetchedamrex)
list(APPEND CMAKE_MODULE_PATH "${fetchedamrex_SOURCE_DIR}/Tools/CMake")
if(AMReX_GPU_BACKEND STREQUAL CUDA)
enable_language(CUDA)
endif()
add_subdirectory(${fetchedamrex_SOURCE_DIR} ${fetchedamrex_BINARY_DIR})
endif()
FetchContent_MakeAvailable(fetchedamrex)
list(APPEND CMAKE_MODULE_PATH "${fetchedamrex_SOURCE_DIR}/Tools/CMake")

# advanced fetch options
mark_as_advanced(FETCHCONTENT_BASE_DIR)
Expand Down
7 changes: 1 addition & 6 deletions cmake/dependencies/pybind11.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,7 @@ function(find_pybind11)
GIT_TAG ${pyAMReX_pybind11_branch}
BUILD_IN_SOURCE 0
)
FetchContent_GetProperties(fetchedpybind11)

if(NOT fetchedpybind11_POPULATED)
FetchContent_Populate(fetchedpybind11)
add_subdirectory(${fetchedpybind11_SOURCE_DIR} ${fetchedpybind11_BINARY_DIR})
endif()
FetchContent_MakeAvailable(fetchedpybind11)

# advanced fetch options
mark_as_advanced(FETCHCONTENT_BASE_DIR)
Expand Down

0 comments on commit 337afa6

Please sign in to comment.