2017-06-11 47 views
0
下铛

我收到以下消息时,我运行LLVM /铛的cmake:cmake的错误建设LLVM/MacOS的

-- 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! 

这里是我使用的命令:

的cmake -G “Unix的Makefile文件” -DCMAKE_BUILD_TYPE =释放 -DLLVM_ENABLE_LTO =在-Wno-dev的..

几个月前,我成功地建立了LLVM /铛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) 
+0

选项'Wno-dev'禁用警告,这可能会导致错误提示。 (可能''IN_LIST'不支持'cmake_minimum_required'中指定的版本。)不带此选项运行'cmake'。 – Tsyvarev

+0

@Tsyvarev:我已经更新了我的问题,并列出了没有'no-dev'选项的输出。 – Tal

回答

2

对于使用IN_LIST运营商if()表达,政策CMP0057应该启用。正如你从警告信息中看到的,这不是你的情况。

该策略可以通过cmake_policy(SET)命令启用。此外,使用足够的版本调用cmake_minimum_required(在特定情况下为“3.3”)会自动启用该策略。

请注意,即使您使用更高版本的CMake,它也不会启用该策略:CMake尊重cmake_minimum_required中给出的版本。

+0

是的。谢谢。我也意识到这一点。我看到LLVM的顶级CMakeLists.txt有这个,但它不会传播到* cmake/modules/AddLLVM.cmake *。因此,我启用了针对该文件的CMP0057策略,并且cmake完成了。我的改变不是处理它的正确方法。但它现在做我需要的。 – Tal