解决cmake Policy CMP0057 is not set: Support new IN_LIST if() operator

解决思路:
通过阅读下面的出错信息,我认为这主要是由于cmake版本变更出现了一些新的操作符的引入和旧的操作符的删除,从而引起的版本不兼容,我在安装boost库时,由于boost库是一个较老的库,而我的cmake是最新版本,因此需要使得我的cmake能够向下兼容。注意下面是IN_LIST操作符出错
– Setting libLAS build type - Release
– Searching for Boost 1.38+ - done
CMake Warning (dev) at /usr/local/lib/cmake/Boost-1.73.0/BoostConfig.cmake:240 (if):
Policy CMP0057 is not set: Support new IN_LIST if() operator. Run “cmake
–help-policy CMP0057” for policy details. Use the cmake_policy command to
set the policy and suppress this warning.

IN_LIST will be interpreted as an operator when the policy is set to NEW.
Since the policy is not set the OLD behavior will be used.
Call Stack (most recent call first):
/usr/share/cmake-3.5/Modules/FindBoost.cmake:245 (find_package)
CMakeLists.txt:193 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Error at /usr/local/lib/cmake/Boost-1.73.0/BoostConfig.cmake:240 (if):
if given arguments:

"ALL" "IN_LIST" "Boost_FIND_COMPONENTS"

Unknown arguments specified
Call Stack (most recent call first):
/usr/share/cmake-3.5/Modules/FindBoost.cmake:245 (find_package)
CMakeLists.txt:193 (find_package)

– Configuring incomplete, errors occurred!
See also “/home/wy/env/libLAS-1.8.1/makefiles/CMakeFiles/CMakeOutput.log”.
See also “/home/wy/env/libLAS-1.8.1/makefiles/CMakeFiles/CMakeError.log”.

查阅cmake官网,找到了如下的内容:
解决cmake Policy CMP0057 is not set: Support new IN_LIST if() operator_第1张图片
解决cmake Policy CMP0057 is not set: Support new IN_LIST if() operator_第2张图片
感觉离答案越来越近了:
解决cmake Policy CMP0057 is not set: Support new IN_LIST if() operator_第3张图片
主意之前里面提到的错误:
IN_LIST will be interpreted as an operator when the policy is set to NEW
因此考虑采用
if(POLICY CMP0057)
cmake_policy(SET CMP0057 NEW)
endif()
cmake在240行报错,找到该文件,在前面添加
解决cmake Policy CMP0057 is not set: Support new IN_LIST if() operator_第4张图片
再次cmake时跳过了CMP0057错误,而是:
解决cmake Policy CMP0057 is not set: Support new IN_LIST if() operator_第5张图片
不慌,同样的操作来一遍,然后此类问题解决了,又出现了新的
解决cmake Policy CMP0057 is not set: Support new IN_LIST if() operator_第6张图片
提示安装库,ok

更新,这个是在编译过程中编译报错说boostconfig.cmake这个文件中需要设置Policy CMP00XX,但其实自己要编译的库中的cmakelist文件中已经声明了部分CMP00xx,因此也可以尝试在要编译的库的cmakelist中添加。

你可能感兴趣的:(工具使用,liblas,boost,cmake错误,cmake_policy,CMP0057/CMP0011)