Skip to content

Commit aae2863

Browse files
committed
CMake fix
1 parent be1e665 commit aae2863

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

toolchain/dependencies/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,17 @@ if (MFC_SILO)
8282
else()
8383
find_package(Git REQUIRED)
8484

85+
# When the system HDF5 is the MPI-enabled variant (e.g. libhdf5-openmpi-dev),
86+
# its headers transitively include mpi.h. Propagate MPI include dirs into the
87+
# silo sub-build so those headers can be found.
88+
find_package(MPI COMPONENTS C QUIET)
89+
set(_silo_c_flags "${CMAKE_C_FLAGS}")
90+
if (MPI_C_FOUND)
91+
foreach(_dir IN LISTS MPI_C_INCLUDE_DIRS)
92+
string(APPEND _silo_c_flags " -I${_dir}")
93+
endforeach()
94+
endif()
95+
8596
ExternalProject_Add(silo
8697
GIT_REPOSITORY "https://github.com/LLNL/Silo"
8798
GIT_TAG 4.12.0
@@ -98,6 +109,7 @@ if (MFC_SILO)
98109
"-DCMAKE_FIND_ROOT_PATH=${CMAKE_FIND_ROOT_PATH}"
99110
"-DCMAKE_FIND_PACKAGE_REDIRECTS_DIR=${CMAKE_FIND_PACKAGE_REDIRECTS_DIR}"
100111
"-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}"
112+
"-DCMAKE_C_FLAGS=${_silo_c_flags}"
101113
"$<$<STREQUAL:${CMAKE_Fortran_COMPILER_ID},Cray>:-DCMAKE_MODULE_PATH=${CMAKE_SOURCE_DIR}/../cmake/cce>"
102114
)
103115
endif()

0 commit comments

Comments
 (0)