Skip to content

Commit 8fb2490

Browse files
committed
HDF5 build: use -fno-strict-aliasing for MPICH
THis is per observed warning messages
1 parent 02b5ce2 commit 8fb2490

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,15 @@ include(cmake/compilers.cmake)
4040

4141
# if HDF5-MPI, ensure all the pieces are working together at configure time.
4242
if(hdf5_parallel)
43+
44+
set(MPI_DETERMINE_LIBRARY_VERSION true)
45+
4346
find_package(MPI COMPONENTS C Fortran REQUIRED)
4447
include(cmake/check_mpi.cmake)
4548
check_mpi_version()
4649

50+
message(STATUS "MPI: ${MPI_Fortran_VERSION_STRING}")
51+
4752
if(h5fortran_find)
4853
find_package(HDF5 COMPONENTS Fortran parallel)
4954
endif()

cmake/hdf5.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ set(hdf5_cmake_args
104104
# -DHDF5_USE_GNU_DIRS:BOOL=ON # new for 1.14
105105
# -DHDF5_ENABLE_ZLIB_SUPPORT:BOOL=ON switched from -DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=ON for HDF5 2.0
106106

107+
if(MPI_Fortran_LIBRARY_VERSION_STRING MATCHES "MPICH")
108+
list(APPEND hdf5_cmake_flags "$<$<COMPILE_LANG_AND_ID:C,AppleClang,Clang,GNU,IntelLLVM>:-fno-strict-aliasing>")
109+
endif()
110+
107111
if(MPI_ROOT)
108112
list(APPEND hdf5_cmake_args -DMPI_ROOT:PATH=${MPI_ROOT})
109113
endif()

0 commit comments

Comments
 (0)