diff --git a/openPMDConfig.cmake.in b/openPMDConfig.cmake.in index 3f6902e503..4cf4ff1732 100644 --- a/openPMDConfig.cmake.in +++ b/openPMDConfig.cmake.in @@ -31,7 +31,12 @@ set(openPMD_HDF5_FOUND ${openPMD_HAVE_HDF5}) set(openPMD_HAVE_ADIOS2 @openPMD_HAVE_ADIOS2@) if(openPMD_HAVE_ADIOS2) - find_dependency(ADIOS2) + set(openPMD_REQUIRED_ADIOS2_COMPONENTS CXX) + if(openPMD_HAVE_MPI) + LIST(APPEND openPMD_REQUIRED_ADIOS2_COMPONENTS MPI) + endif() + find_dependency(ADIOS2 COMPONENTS ${openPMD_REQUIRED_ADIOS2_COMPONENTS}) + unset(openPMD_REQUIRED_ADIOS2_COMPONENTS) endif() set(openPMD_ADIOS2_FOUND ${openPMD_HAVE_ADIOS2})