cmake 在MacOS上使用clang-15在FindTerminfo中出错

iih3973s  于 9个月前  发布在  Mac
关注(0)|答案(1)|浏览(108)

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

怎么修?

xoefb8l8

xoefb8l81#

它实际上是clang-14和更高版本中著名的issue
临时解决方案是在项目中使用C语言。

project(test LANGUAGES C CXX) # instead of project(test LANGUAGES CXX)

相关问题