当我为llvm / clang运行cmake时,出现以下消息:
-- Performing Test COMPILER_RT_TARGET_HAS_ATOMICS - Success
CMake Error at cmake/modules/AddLLVM.cmake:589 (if):
if given arguments:
"LTO" "IN_LIST" "LLVM_DISTRIBUTION_COMPONENTS" "OR" "NOT" "LLVM_DISTRIBUTION_COMPONENTS"
Unknown arguments specified
Call Stack (most recent call first):
tools/lto/CMakeLists.txt:19 (add_llvm_library)
-- Configuring incomplete, errors occurred!
这是我正在使用的命令:
几个月前,我成功构建了llvm / clang 5.0。但是今天,我在各个目录和子目录上执行了“ git pull ”以获取最新更改。
另外,我将cmake更新为3.8.2。但这没有帮助。
每个评论者的请求都是不带
no-dev
选项的输出:-- Performing Test COMPILER_RT_TARGET_HAS_ATOMICS - Success
CMake Warning (dev) at cmake/modules/AddLLVM.cmake:589 (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):
tools/lto/CMakeLists.txt:19 (add_llvm_library)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Error at cmake/modules/AddLLVM.cmake:589 (if):
if given arguments:
"LTO" "IN_LIST" "LLVM_DISTRIBUTION_COMPONENTS" "OR" "NOT" "LLVM_DISTRIBUTION_COMPONENTS"
Unknown arguments specified
Call Stack (most recent call first):
tools/lto/CMakeLists.txt:19 (add_llvm_library)
最佳答案
为了在if()
表达式中使用IN_LIST运算符,应启用策略CMP0057。从警告消息中可以看到,情况并非如此。
可以通过cmake_policy(SET)命令启用该策略。同样,以足够版本(在给定情况下为“3.3”)调用的cmake_minimum_required
会自动启用该策略。
请注意,即使您使用更高版本的CMake,也不会启用该策略:CMake会遵循cmake_minimum_required
中给出的版本。
关于c++ - 在macOS下构建llvm/clang的cmake错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/44480506/