Skip to content

Commit 7181502

Browse files
committed
Linking with all LLVM libraries
Also adding " -Wl,--no-undefined" to the link flags.
1 parent d487d2e commit 7181502

File tree

1 file changed

+6
-43
lines changed

1 file changed

+6
-43
lines changed

CMakeLists.txt

Lines changed: 6 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -175,53 +175,13 @@ link_directories(
175175
${LLVM_LIBRARY_DIRS}
176176
)
177177

178-
if (LLVM_LINK_LLVM_DYLIB)
179-
set (LLVM_COMPONENTS LLVM)
180-
else (LLVM_LINK_LLVM_DYLIB)
181-
set (LLVM_COMPONENTS
182-
Analysis
183-
AsmParser
184-
AsmPrinter
185-
BitReader
186-
BitWriter
187-
CodeGen
188-
Core
189-
IRReader
190-
InstCombine
191-
Instrumentation
192-
MC
193-
MCDisassembler
194-
MCParser
195-
ObjCARCOpts
196-
Object
197-
Option
198-
ProfileData
199-
ScalarOpts
200-
SelectionDAG
201-
Support
202-
Target
203-
TransformUtils
204-
Vectorize
205-
X86AsmParser
206-
X86AsmPrinter
207-
X86CodeGen
208-
X86Desc
209-
X86Disassembler
210-
X86Info
211-
X86Utils)
212-
endif (LLVM_LINK_LLVM_DYLIB)
213-
214178
set(ADDITIONAL_LIBS )
215179

216-
if(USE_PREBUILT_LLVM AND NOT LLVMSPIRV_INCLUDED_IN_LLVM)
180+
if(USE_PREBUILT_LLVM)
217181
# SPIRV-LLVM-Translator is not included into LLVM as a component.
218182
# So, we need to list it here explicitly as an external library
219183
set(ADDITIONAL_LIBS LLVMSPIRVLib)
220-
else()
221-
# SPIRV-LLVM-Translator is built as part of LLVM build.
222-
# We should add it to the list of LLVM components
223-
list(APPEND LLVM_COMPONENTS SPIRVLib)
224-
endif(USE_PREBUILT_LLVM AND NOT LLVMSPIRV_INCLUDED_IN_LLVM)
184+
endif(USE_PREBUILT_LLVM)
225185

226186
add_subdirectory(cl_headers)
227187

@@ -234,7 +194,7 @@ add_llvm_library(${TARGET_NAME} SHARED
234194

235195
DEPENDS CClangCompileOptions
236196
LINK_COMPONENTS
237-
${LLVM_COMPONENTS}
197+
all
238198
LINK_LIBS
239199
# The list of clang libraries is taken from clang makefile
240200
# (build/tools/clang/tools/driver/CMakeFiles/clang.dir/link.txt)
@@ -302,6 +262,9 @@ if (WIN32)
302262
"RC_PRODUCT_NAME=\"${RC_PRODUCT_NAME}\""
303263
"RC_PRODUCT_VERSION=\"${RC_FILE_VERSION}\""
304264
"RC_COPYRIGHT=\"Copyright ${RC_CHAR_C} 2018 Intel Corporation. All rights reserved.\"")
265+
elseif(UNIX)
266+
set_property(TARGET ${TARGET_NAME} APPEND_STRING PROPERTY
267+
LINK_FLAGS " -Wl,--no-undefined")
305268
endif(WIN32)
306269

307270
install(FILES common_clang.h

0 commit comments

Comments
 (0)