[PATCH] D85820: Use find_library for ncurses

Harmen Stoppels via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 12 02:00:52 PDT 2020


haampie created this revision.
haampie added reviewers: smeenai, compnerd, JDevlieghere, kuhnel, phosek.
Herald added subscribers: llvm-commits, mgorny.
Herald added a project: LLVM.
haampie requested review of this revision.

Currently it is hard to avoid having LLVM link to the system install of ncurses, since it uses check_library_exists to find e.g. libtinfo and not find_library or find_package.

This is a similar change as https://reviews.llvm.org/D79219, which just landed in master.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85820

Files:
  llvm/cmake/config-ix.cmake


Index: llvm/cmake/config-ix.cmake
===================================================================
--- llvm/cmake/config-ix.cmake
+++ llvm/cmake/config-ix.cmake
@@ -149,15 +149,11 @@
     endif()
     if(LLVM_ENABLE_TERMINFO)
       set(HAVE_TERMINFO 0)
-      foreach(library terminfo tinfo curses ncurses ncursesw)
-        string(TOUPPER ${library} library_suffix)
-        check_library_exists(${library} setupterm "" HAVE_TERMINFO_${library_suffix})
-        if(HAVE_TERMINFO_${library_suffix})
-          set(HAVE_TERMINFO 1)
-          set(TERMINFO_LIBS "${library}")
-          break()
-        endif()
-      endforeach()
+      find_library(FIND_TERMINFO NAMES terminfo tinfo curses ncurses ncursesw)
+      if(FIND_TERMINFO)
+        set(HAVE_TERMINFO 1)
+        set(TERMINFO_LIBS "${FIND_TERMINFO}")
+      endif()
     else()
       set(HAVE_TERMINFO 0)
     endif()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85820.285010.patch
Type: text/x-patch
Size: 884 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200812/7b27affd/attachment.bin>


More information about the llvm-commits mailing list