From 56d949f05f37c65401825a30be0d39bd152cc33c Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 1 Nov 2021 08:09:15 -0400 Subject: 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 --- Modules/FindMPI.cmake | 4 ++-- 1 file 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) -- cgit v0.12