解决LLVM项目中CMake 报错 "if given arguments *** Unknown arguments specified"

解决LLVM项目中CMake 报错 “if given arguments *** Unknown arguments specified”

报错信息如下:

  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):
  tools/lto/CMakeLists.txt:27 (add_llvm_library)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Error at cmake/modules/AddLLVM.cmake:691 (if):
  if given arguments:

    "LTO" "IN_LIST" "LLVM_DISTRIBUTION_COMPONENTS" "OR" "(" "in_llvm_libs" "AND" "llvm-libraries" "IN_LIST" "LLVM_DISTRIBUTION_COMPONENTS" ")" "OR" "NOT" "LLVM_DISTRIBUTION_COMPONENTS"

  Unknown arguments specified
Call Stack (most recent call first):
  tools/lto/CMakeLists.txt:27 (add_llvm_library)

这样的cmake报错信息,是由于我将multicompiler的代码合并到llvm-9.0版本中,创建cmake工程的时候报的。

经过一番捣鼓,发现是cmake中cmake-min-version设置的问题,导致multicompiler的compiler-rt项目cmake报错。修改llvm/projects/compiler-rt/CMakeLists.txt文件中cmake-min-version为3.4.3(我系统中安装的cmake是这个版本,版本过低是报这种错误的主要原因),使得compiler-rt项目中的cmake-min-version版本好和LLVM项目的版本号一致。

修改如下;

 18 # The CompilerRT build system requires CMake version 2.8.8 or higher in order
 19 # to use its support for building convenience "libraries" as a collection of
 20 # .o files. This is particularly useful in producing larger, more complex
 21 # runtime libraries.
 22 if (NOT MSVC)
 23 --- cmake_minimum_required(VERSION 2.8.8)
 23 +++ cmake_minimum_required(VERSION 3.4.3)
 24 else()
 25   # Version 2.8.12.1 is required to build with Visual Studio 2013.
 26 --- cmake_minimum_required(VERSION 2.8.12.1)
 26 +++ cmake_minimum_required(VERSION 3.4.3)
 27 endif()

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值