为什么find_package在较新的CMake版本中失败?

时间:2019-05-15 08:16:30

标签: cmake mpi cmake-modules

从CMake 3.8升级到3.14时,我在项目中遇到问题。我将其简化为以下问题。请注意,projectfind_package之前(相反,我没有所描述的问题)。

cmake_minimum_required(VERSION 3.2.1)
find_package(MPI REQUIRED)
project(Test CXX)).

当我使用CMake 3.8进行构建时,输出如下:

build3_8$ cmake ../source/
-- The CXX compiler identification is Intel 17.0.5.20170817
-- Check for working CXX compiler: (...)/linux/bin/intel64/icpc
-- Check for working CXX compiler: (...)/linux/bin/intel64/icpc -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: (...)/build3_8

使用CMake 3.14,我得到以下输出:

build3_14$ cmake ../source/
CMake Error at (...)/CMake/3.14.0/share/cmake-3.14/Modules/FindPackageHandleStandardArgs.cmake:211 (message):
  No REQUIRED_VARS specified for FIND_PACKAGE_HANDLE_STANDARD_ARGS()
Call Stack (most recent call first):
  (...)/CMake/3.14.0/share/cmake-3.14/Modules/FindMPI.cmake:1672 (find_package_handle_standard_args)
  CMakeLists.txt:3 (find_package)


-- Configuring incomplete, errors occurred!

我想知道为什么更新的CMake版本会发生这种情况(尽管FindMPI.cmake完全不同)?

此外,我该怎么做才能解决此问题?我需要编写自己的配置吗?

(我不能只更改projectfind_package的顺序,因为包装是为编译器创建的(不是我的选择,请不要怪我))

0 个答案:

没有答案