Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CMake error in FindTerminfo with clang-15 on MacOS

I'm using llvm in my project and find it with cmake's find_package(LLVM REQUIRED CONFIG).

Configuration fails with message:

[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!

How to fix it?

like image 621
gavrilikhin.d Avatar asked Oct 16 '25 21:10

gavrilikhin.d


1 Answers

It's actually a well-known issue in clang-14 and greater.

Temporary solution is to use C language in your project.

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

Update

The fix is no longer necessary since clang 19.1.2

like image 126
gavrilikhin.d Avatar answered Oct 18 '25 16:10

gavrilikhin.d



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!