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

当使用较新版本的CMake构建旧库(如libLAS)时,可能会遇到CMP0057警告,这是由于新引入的IN_LIST操作符与旧版本不兼容。解决方法是在CMakeLists.txt中添加`if(POLICY CMP0057)`和`cmake_policy(SET CMP0057 NEW)`,以使CMake支持新的操作符。尽管这能解决CMP0057警告,但在后续编译过程中可能还会遇到其他依赖库的兼容性问题。
摘要由CSDN通过智能技术生成

解决思路:
通过阅读下面的出错信息,我认为这主要是由于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/lo

  • 14
    点赞
  • 24
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值