cmake 在 macOS 下构建错误 llvm/clang
cmake error building llvm/clang under macOS
当我 运行 cmake for llvm/clang 时,我收到以下消息:
-- 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 Makefiles" -DCMAKE_BUILD_TYPE=Release
-DLLVM_ENABLE_LTO=On -Wno-dev ..
几个月前,我成功构建了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) 命令启用该策略。此外,cmake_minimum_required
使用足够的版本(在给定情况下为“3.3”)调用会自动启用该策略。
请注意,即使您使用更高版本的 CMake,它也不会启用该策略:CMake 尊重 cmake_minimum_required
中给出的版本。
当我 运行 cmake for llvm/clang 时,我收到以下消息:
-- 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 Makefiles" -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_LTO=On -Wno-dev ..
几个月前,我成功构建了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) 命令启用该策略。此外,cmake_minimum_required
使用足够的版本(在给定情况下为“3.3”)调用会自动启用该策略。
请注意,即使您使用更高版本的 CMake,它也不会启用该策略:CMake 尊重 cmake_minimum_required
中给出的版本。