[PATCH] D116427: FindTerminfo.cmake: Don't require that C language support be enabled for CMake project.
Shane Harper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 30 16:32:08 PST 2021
shaneharper created this revision.
shaneharper added a reviewer: jackoalan.
Herald added a subscriber: mgorny.
shaneharper requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Here's a simple CMakeLists.txt that demonstrates the problem:
project("My project does not use C" CXX)
set(LLVM_DIR "${LLVM_obj-root}/lib/cmake/llvm")
find_package(LLVM REQUIRED CONFIG)
Test with:
cmake . -DLLVM_obj-root=`llvm-config --obj-root`
Without the patch to FindTerminfo.cmake CMake v3.16.3 will fail with:
Unknown extension ".c" for file
...
try_compile() works only for enabled languages.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D116427
Files:
llvm/cmake/modules/FindTerminfo.cmake
Index: llvm/cmake/modules/FindTerminfo.cmake
===================================================================
--- llvm/cmake/modules/FindTerminfo.cmake
+++ llvm/cmake/modules/FindTerminfo.cmake
@@ -15,11 +15,11 @@
if(Terminfo_LIBRARIES)
include(CMakePushCheckState)
- include(CheckCSourceCompiles)
+ include(CheckCXXSourceCompiles)
cmake_push_check_state()
list(APPEND CMAKE_REQUIRED_LIBRARIES ${Terminfo_LIBRARIES})
- check_c_source_compiles("
- int setupterm(char *term, int filedes, int *errret);
+ check_cxx_source_compiles("
+ extern \"C\" { int setupterm(char *term, int filedes, int *errret); }
int main() { return setupterm(0, 0, 0); }"
Terminfo_LINKABLE)
cmake_pop_check_state()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116427.396729.patch
Type: text/x-patch
Size: 725 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211231/6dd4f96b/attachment.bin>
More information about the llvm-commits
mailing list