From 9750f26a70938770e2c9742a5c71c11a199cd339 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franz=20P=C3=B6schel?= Date: Wed, 6 Nov 2024 12:50:36 +0100 Subject: [PATCH 1/2] Explicitly specify ADIOS2 components in openPMDConfig.cmake When including openPMD in downstream CMake and that CMake script contains Fortran, ADIOS2 will automatically detect that. But since we do not reexport the ADIOS2 headers, we only need the components that openPMD explicitly uses: CXX and MPI. --- openPMDConfig.cmake.in | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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}) From 6132928b2c4a37c2ba8be3ad4f0caa1e037f967f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franz=20P=C3=B6schel?= Date: Fri, 8 Nov 2024 15:04:02 +0100 Subject: [PATCH 2/2] Same in CMakeLists.txt --- CMakeLists.txt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fc5d6d5de5..c57e3b7fe6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -360,20 +360,24 @@ if(openPMD_HDF5_STATUS) endif() # external library: ADIOS2 (optional) +set(openPMD_REQUIRED_ADIOS2_COMPONENTS CXX) +if(openPMD_HAVE_MPI) + list(APPEND openPMD_REQUIRED_ADIOS2_COMPONENTS MPI) +endif() if(openPMD_USE_ADIOS2 STREQUAL AUTO) - find_package(ADIOS2 2.7.0 CONFIG) + find_package(ADIOS2 2.7.0 CONFIG COMPONENTS ${openPMD_REQUIRED_ADIOS2_COMPONENTS}) if(ADIOS2_FOUND) set(openPMD_HAVE_ADIOS2 TRUE) else() set(openPMD_HAVE_ADIOS2 FALSE) endif() elseif(openPMD_USE_ADIOS2) - find_package(ADIOS2 2.7.0 REQUIRED CONFIG) + find_package(ADIOS2 2.7.0 REQUIRED CONFIG COMPONENTS ${openPMD_REQUIRED_ADIOS2_COMPONENTS}) set(openPMD_HAVE_ADIOS2 TRUE) else() set(openPMD_HAVE_ADIOS2 FALSE) endif() -# TODO: Check if ADIOS2 is parallel when openPMD_HAVE_MPI is ON +unset(openPMD_REQUIRED_ADIOS2_COMPONENTS) # external library: pybind11 (optional) include(${openPMD_SOURCE_DIR}/cmake/dependencies/pybind11.cmake)