diff --git a/cmake/SetupBOUTThirdParty.cmake b/cmake/SetupBOUTThirdParty.cmake index 656835f30a..b7c222eb72 100644 --- a/cmake/SetupBOUTThirdParty.cmake +++ b/cmake/SetupBOUTThirdParty.cmake @@ -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) @@ -211,14 +214,11 @@ if (BOUT_USE_ADIOS2) # Note: SST requires 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})