Skip to content

Commit

Permalink
CMake: Reduce duplication in linking against adios2
Browse files Browse the repository at this point in the history
  • Loading branch information
ZedThree committed Jan 23, 2025
1 parent 77ed8db commit d5c14c1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cmake/SetupBOUTThirdParty.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ set(BOUT_HAS_NETCDF ${BOUT_USE_NETCDF})
option(BOUT_USE_ADIOS2 "Enable support for ADIOS output" OFF)
option(BOUT_DOWNLOAD_ADIOS2 "Download and build ADIOS2" OFF)
if (BOUT_USE_ADIOS2)
enable_language(C)
find_package(MPI REQUIRED COMPONENTS C)

if (BOUT_DOWNLOAD_ADIOS2)
message(STATUS "Downloading and configuring ADIOS2")
include(FetchContent)
Expand All @@ -211,14 +214,11 @@ if (BOUT_USE_ADIOS2)
# Note: SST requires <rdma/fabric.h> but doesn't check at configure time
set(ADIOS2_USE_SST OFF CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(adios2)
target_link_libraries(bout++ PUBLIC adios2::cxx11_mpi)
message(STATUS "ADIOS2 done configuring")
else()
find_package(ADIOS2 REQUIRED)
enable_language(C)
find_package(MPI REQUIRED COMPONENTS C)
target_link_libraries(bout++ PUBLIC adios2::cxx11_mpi MPI::MPI_C)
endif()
target_link_libraries(bout++ PUBLIC adios2::cxx11_mpi MPI::MPI_C)
endif()
message(STATUS "ADIOS2 support: ${BOUT_USE_ADIOS2}")
set(BOUT_HAS_ADIOS2 ${BOUT_USE_ADIOS2})
Expand Down

0 comments on commit d5c14c1

Please sign in to comment.