为什么 find_package(MPI) 会生成警告消息?
Why does find_package(MPI) generate a warning message?
我正在使用 CMake 3.22.0-rc2。当我 运行:
find_package(MPI)
我收到警告:
CMake Warning (dev) at /opt/versions/cmake/3.22.0-rc2/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
The package name passed to `find_package_handle_standard_args` (PkgConfig)
does not match the name of the calling package (MPI). This can lead to
problems in calling code that expects `find_package` result variables
(e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
/opt/versions/cmake/3.22.0-rc2/share/cmake-3.22/Modules/FindPkgConfig.cmake:88 (find_package_handle_standard_args)
/opt/versions/cmake/3.22.0-rc2/share/cmake-3.22/Modules/FindMPI.cmake:270 (include)
examples/multi-gpu-programming-models/CMakeLists.txt:2 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.
我知道我可以抑制这个错误,但是 - 它与我在 CMakeLists.txt
中得到的东西有什么关系还是这是某种内部 CMake(半)错误?
此警告最近已在 https://github.com/Kitware/CMake/commit/56d949f05f37c65401825a30be0d39bd152cc33c 中修复。
它是模块 FindPkgConfig.cmake
的 incorrect inclusion 通过
include(${CMAKE_CURRENT_LIST_DIR}/FindPkgConfig.cmake)
有了这样的包含,在 FindPkgConfig.cmake
中执行的对 find_package_handle_standard_args
的调用被解释为来自 FindMPI.cmake
模块,因为最新的 find_package
调用有 MPI
参数而不是 PkgConfig
.
像 FindXXX.cmake
这样的所有模块都应该通过 find_package
:
包含
find_package(PkgConfig)
我正在使用 CMake 3.22.0-rc2。当我 运行:
find_package(MPI)
我收到警告:
CMake Warning (dev) at /opt/versions/cmake/3.22.0-rc2/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
The package name passed to `find_package_handle_standard_args` (PkgConfig)
does not match the name of the calling package (MPI). This can lead to
problems in calling code that expects `find_package` result variables
(e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
/opt/versions/cmake/3.22.0-rc2/share/cmake-3.22/Modules/FindPkgConfig.cmake:88 (find_package_handle_standard_args)
/opt/versions/cmake/3.22.0-rc2/share/cmake-3.22/Modules/FindMPI.cmake:270 (include)
examples/multi-gpu-programming-models/CMakeLists.txt:2 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.
我知道我可以抑制这个错误,但是 - 它与我在 CMakeLists.txt
中得到的东西有什么关系还是这是某种内部 CMake(半)错误?
此警告最近已在 https://github.com/Kitware/CMake/commit/56d949f05f37c65401825a30be0d39bd152cc33c 中修复。
它是模块 FindPkgConfig.cmake
的 incorrect inclusion 通过
include(${CMAKE_CURRENT_LIST_DIR}/FindPkgConfig.cmake)
有了这样的包含,在 FindPkgConfig.cmake
中执行的对 find_package_handle_standard_args
的调用被解释为来自 FindMPI.cmake
模块,因为最新的 find_package
调用有 MPI
参数而不是 PkgConfig
.
像 FindXXX.cmake
这样的所有模块都应该通过 find_package
:
find_package(PkgConfig)