9
9
# IGC_OPTION__LLDELF_LIB_DIR - Specify additional directories for searching lldELF library
10
10
# IGC_OPTION__LLDELF_H_DIR - Specify additional directories for searching lldELF headers
11
11
12
- function (find_lld_library VAR LIB_NAME )
13
- find_library (${VAR}
12
+ function (add_lld_library LIB_NAME )
13
+ find_library (${LIB_NAME} _PATH
14
14
${LIB_NAME}
15
15
PATHS "${IGC_OPTION__LLDELF_LIB_DIR} "
16
16
PATH_SUFFIXES "llvm-${LLVM_VERSION_MAJOR} /lib" )
17
17
18
- if (${VAR} -NOTFOUND )
18
+ if (${LIB_NAME} _PATH -NOTFOUND )
19
19
message (FATAL_ERROR
20
20
"Cannot find ${LIB_NAME} library, please install missing library or provide the path by IGC_OPTION__LLDELF_LIB_DIR" )
21
21
endif ()
22
+ add_library (${LIB_NAME} UNKNOWN IMPORTED GLOBAL )
23
+ set_target_properties (${LIB_NAME} PROPERTIES IMPORTED_LOCATION ${${LIB_NAME}_PATH} )
22
24
endfunction ()
23
25
24
26
if (IGC_BUILD__LLVM_SOURCES )
25
- set (LLD_ELF_LIB lldELF )
26
- set (LLD_COM_LIB lldCommon )
27
27
get_target_property (lldELF_SRC_DIR lldELF SOURCE_DIR )
28
28
set (LLD_INCLUDE_DIR "${lldELF_SRC_DIR} /../include" )
29
29
elseif (IGC_BUILD__LLVM_PREBUILDS )
30
- find_lld_library (LLD_ELF_LIB lldELF )
31
- find_lld_library (LLD_COM_LIB lldCommon )
30
+ add_lld_library (lldELF )
31
+ add_lld_library (lldCommon )
32
+ igc_get_llvm_targets (LLD_COMMON_LLVM_DEPS
33
+ Codegen
34
+ Core
35
+ DebugInfoDWARF
36
+ Demangle
37
+ MC
38
+ Option
39
+ Support
40
+ Target )
41
+ igc_get_llvm_targets (LLD_ELF_LLVM_DEPS
42
+ ${LLVM_TARGETS_TO_BUILD}
43
+ BinaryFormat
44
+ BitWriter
45
+ Core
46
+ DebugInfoDWARF
47
+ Demangle
48
+ LTO
49
+ MC
50
+ Object
51
+ Option
52
+ Passes
53
+ Support )
54
+ target_link_libraries (lldCommon INTERFACE
55
+ ${LLD_COMMON_LLVM_DEPS} )
56
+ target_link_libraries (lldELF INTERFACE
57
+ ${LLD_ELF_LLVM_DEPS}
58
+ lldCommon )
32
59
33
60
find_path (
34
61
LLD_INCLUDE_DIR
@@ -45,7 +72,6 @@ elseif(IGC_BUILD__LLVM_PREBUILDS)
45
72
endif ()
46
73
47
74
list (APPEND IGC_BUILD__LLVM_LIBS_TO_LINK
48
- ${LLD_ELF_LIB}
49
- ${LLD_COM_LIB} )
75
+ lldELF )
50
76
51
77
include_directories (${LLD_INCLUDE_DIR} )
0 commit comments