summaryrefslogtreecommitdiffstats
path: root/Modules/FindMPI.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-11-01 12:09:15 (GMT)
committerBrad King <brad.king@kitware.com>2021-11-01 12:09:15 (GMT)
commit56d949f05f37c65401825a30be0d39bd152cc33c (patch)
tree152a074ad1f7e11765562d3044deacf17ad2a0ee /Modules/FindMPI.cmake
parent6b64cc12affc514d682ccfc2e11d30d298236707 (diff)
downloadCMake-56d949f05f37c65401825a30be0d39bd152cc33c.zip
CMake-56d949f05f37c65401825a30be0d39bd152cc33c.tar.gz
CMake-56d949f05f37c65401825a30be0d39bd152cc33c.tar.bz2
FindMPI: Fix finding PkgConfg for fallback
In commit 0723b2c935 (MPI: Add fallback detection code for MPI when cross compiling, 2021-09-17, v3.22.0-rc1~89^2) the FindPkgConfig module was included directly. This produces warnings like: The package name passed to `find_package_handle_standard_args` (PkgConfig) does not match the name of the calling package (MPI). Use `find_package(PkgConfig)` instead, as other find modules do. Fixes: #22823
Diffstat (limited to 'Modules/FindMPI.cmake')
-rw-r--r--Modules/FindMPI.cmake4
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake
index 62412ae..c974d33 100644
--- a/Modules/FindMPI.cmake
+++ b/Modules/FindMPI.cmake
@@ -267,7 +267,7 @@ cmake_policy(PUSH)
cmake_policy(SET CMP0057 NEW) # if IN_LIST
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-include(${CMAKE_CURRENT_LIST_DIR}/FindPkgConfig.cmake)
+find_package(PkgConfig QUIET)
# Generic compiler names
set(_MPI_C_GENERIC_COMPILER_NAMES mpicc mpcc mpicc_r mpcc_r)
@@ -1583,7 +1583,7 @@ foreach(LANG IN ITEMS C CXX Fortran)
else()
set(_MPI_PKG "")
endif()
- if(_MPI_PKG)
+ if(_MPI_PKG AND PKG_CONFIG_FOUND)
pkg_check_modules("MPI_${LANG}_PKG" "${_MPI_PKG}")
if("${MPI_${LANG}_PKG_FOUND}")
set(MPI_${LANG}_COMPILE_OPTIONS ${MPI_${LANG}_PKG_CFLAGS} CACHE STRING "MPI ${LANG} compilation options" FORCE)