2

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?

Thomas Dickey
  • 51,086
  • 7
  • 70
  • 105
gavrilikhin.d
  • 554
  • 1
  • 7
  • 20

1 Answers1

4

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)
gavrilikhin.d
  • 554
  • 1
  • 7
  • 20
  • Using clang-15, this isn't helping - at this point I'd happily install TermInfo, but I also can't find where on earth to install it from. One way or another, how can I stop this error? – Jamie Birch Jan 15 '23 at 02:13
  • 1
    Sadly, I don't know. And there is no activity on issue above. – gavrilikhin.d Jan 26 '23 at 12:48
  • I guess you can try to change `check_c_source_compiles` to `check_cxx_source_compiles` at `/usr/local/lib/cmake/llvm/FindTerminfo.cmake:21` – gavrilikhin.d Jan 26 '23 at 12:49