MacOS 上使用 clang-15 在 FindTerminfo 中出现 CMake 错误

问题描述 投票:0回答:1

我在我的项目中使用llvm并使用cmake的

find_package(LLVM REQUIRED CONFIG)
找到它。

配置失败并显示消息:

[cmake] CMake Error at /Applications/CMake.app/Contents/share/cmake-3.23/Modules/Internal/CheckSourceCompiles.cmake:44 (message):
[cmake]   check_source_compiles: C: needs to be enabled before use.
[cmake] Call Stack (most recent call first):
[cmake]   /Applications/CMake.app/Contents/share/cmake-3.23/Modules/CheckCSourceCompiles.cmake:76 (cmake_check_source_compiles)
[cmake]   /usr/local/lib/cmake/llvm/FindTerminfo.cmake:21 (check_c_source_compiles)
[cmake]   /usr/local/lib/cmake/llvm/LLVMConfig.cmake:242 (find_package)
[cmake]   tools/driver/CMakeLists.txt:6 (find_package)
[cmake] 
[cmake] 
[cmake] -- Could NOT find Terminfo (missing: Terminfo_LINKABLE) 
[cmake] -- Configuring incomplete, errors occurred!

如何解决?

macos cmake clang llvm terminfo
1个回答
3
投票

这实际上是 clang-14 及更高版本中众所周知的 问题

临时解决方案是在项目中使用C语言。

project(test LANGUAGES C CXX) # instead of project(test LANGUAGES CXX)
© www.soinside.com 2019 - 2024. All rights reserved.