Backport upstream fix for MPI patch

ci/unstable
Timo Röhling 3 years ago
parent e66f1bdbc9
commit 9fc4d8e0c0

@ -8,14 +8,14 @@ Forwarded: https://gitlab.kitware.com/cmake/cmake/-/merge_requests/6537
1 file changed, 35 insertions(+), 1 deletion(-) 1 file changed, 35 insertions(+), 1 deletion(-)
diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake
index d8f0334..f7faa54 100644 index d8f0334..1aaba43 100644
--- a/Modules/FindMPI.cmake --- a/Modules/FindMPI.cmake
+++ b/Modules/FindMPI.cmake +++ b/Modules/FindMPI.cmake
@@ -267,6 +267,7 @@ cmake_policy(PUSH) @@ -267,6 +267,7 @@ cmake_policy(PUSH)
cmake_policy(SET CMP0057 NEW) # if IN_LIST cmake_policy(SET CMP0057 NEW) # if IN_LIST
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(${CMAKE_CURRENT_LIST_DIR}/FindPkgConfig.cmake) +find_package(PkgConfig QUIET)
# Generic compiler names # Generic compiler names
set(_MPI_C_GENERIC_COMPILER_NAMES mpicc mpcc mpicc_r mpcc_r) set(_MPI_C_GENERIC_COMPILER_NAMES mpicc mpcc mpicc_r mpcc_r)
@ -34,7 +34,7 @@ index d8f0334..f7faa54 100644
+ else() + else()
+ set(_MPI_PKG "") + set(_MPI_PKG "")
+ endif() + endif()
+ if(_MPI_PKG) + if(_MPI_PKG AND PKG_CONFIG_FOUND)
+ pkg_check_modules("MPI_${LANG}_PKG" "${_MPI_PKG}") + pkg_check_modules("MPI_${LANG}_PKG" "${_MPI_PKG}")
+ if("${MPI_${LANG}_PKG_FOUND}") + if("${MPI_${LANG}_PKG_FOUND}")
+ set(MPI_${LANG}_COMPILE_OPTIONS ${MPI_${LANG}_PKG_CFLAGS} CACHE STRING "MPI ${LANG} compilation options" FORCE) + set(MPI_${LANG}_COMPILE_OPTIONS ${MPI_${LANG}_PKG_CFLAGS} CACHE STRING "MPI ${LANG} compilation options" FORCE)

Loading…
Cancel
Save