MacOS 上使用 clang-15 时 FindTerminfo 中的 CMake 错误

2024-02-01

我在我的项目中使用 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!

如何修复它?


这实际上是一个众所周知的issue https://github.com/llvm/llvm-project/issues/53950在 clang-14 及更高版本中。

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

project(test LANGUAGES C CXX) # instead of project(test LANGUAGES CXX)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

MacOS 上使用 clang-15 时 FindTerminfo 中的 CMake 错误 的相关文章

随机推荐