blob: 64d429a7e92f94009b698ead05d884ec827f98f4 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
From 0f5e8e4368199ab993470dc4e7df5d91b806c557 Mon Sep 17 00:00:00 2001
From: Harmen Stoppels <harmenstoppels@gmail.com>
Date: Tue, 11 Aug 2020 15:06:24 +0200
Subject: [PATCH] Use find_library for zlib and ncurses
find_library makes it easier to use a non-system version of zlib and
ncurses, since it respects *_ROOT and CMAKE_PREFIX_PATH.
---
llvm/cmake/config-ix.cmake | 28 ++++++++++------------------
1 file changed, 10 insertions(+), 18 deletions(-)
diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake
index 612ce5bdbcb..e748e5ef8c1 100644
--- a/llvm/cmake/config-ix.cmake
+++ b/llvm/cmake/config-ix.cmake
@@ -120,15 +120,11 @@ endif()
if(NOT LLVM_USE_SANITIZER MATCHES "Memory.*")
set(HAVE_LIBZ 0)
if(LLVM_ENABLE_ZLIB)
- foreach(library z zlib_static zlib)
- string(TOUPPER ${library} library_suffix)
- check_library_exists(${library} compress2 "" HAVE_LIBZ_${library_suffix})
- if(HAVE_LIBZ_${library_suffix})
- set(HAVE_LIBZ 1)
- set(ZLIB_LIBRARIES "${library}")
- break()
- endif()
- endforeach()
+ find_library(FIND_ZLIB NAMES z zlib_static zlib)
+ if(FIND_ZLIB)
+ set(HAVE_LIBZ 1)
+ set(ZLIB_LIBRARIES "${FIND_ZLIB}")
+ endif()
endif()
# Don't look for these libraries on Windows.
@@ -141,15 +137,11 @@ if(NOT LLVM_USE_SANITIZER MATCHES "Memory.*")
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()
--
2.25.1
|