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?
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)
The fix is no longer necessary since clang 19.1.2