2017-06-11 48 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