#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by
+# Copyright (c) 2012,2013,2014,2015,2016,2019, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
if(NOT MPI_FOUND)
find_package(MPI)
if(MPI_C_FOUND)
- set(MPI_COMPILE_FLAGS ${MPI_C_COMPILE_FLAGS})
- set(MPI_LINKER_FLAGS ${MPI_C_LINK_FLAGS})
- include_directories(SYSTEM ${MPI_C_INCLUDE_PATH})
- list(APPEND GMX_COMMON_LIBRARIES ${MPI_C_LIBRARIES})
+ # workaround for rhel bug #1749463, cmake bug #18349, fixed in cmake-3.12.3
+ if(CMAKE_VERSION VERSION_LESS "3.12.3")
+ set(MPI_COMPILE_FLAGS)
+ foreach(_MPI_FLAG ${MPI_C_COMPILE_FLAGS})
+ set(MPI_COMPILE_FLAGS "${MPI_COMPILE_FLAGS} ${_MPI_FLAG}")
+ endforeach()
+ set(MPI_LINKER_FLAGS)
+ foreach(_MPI_FLAG ${MPI_C_LINK_FLAGS})
+ set(MPI_LINKER_FLAGS "${MPI_LINKER_FLAGS} ${_MPI_FLAG}")
+ endforeach()
+ else()
+ set(MPI_COMPILE_FLAGS ${MPI_C_COMPILE_FLAGS})
+ set(MPI_LINKER_FLAGS ${MPI_C_LINK_FLAGS})
+ endif()
+ include_directories(SYSTEM ${MPI_C_INCLUDE_PATH})
+ list(APPEND GMX_COMMON_LIBRARIES ${MPI_C_LIBRARIES})
endif()
set(MPI_FOUND ${MPI_C_FOUND})
else()