diff --git a/CMakeLists.txt b/CMakeLists.txt index 67ac6015..174133b2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -175,54 +175,13 @@ link_directories( ${LLVM_LIBRARY_DIRS} ) -if (LLVM_LINK_LLVM_DYLIB) - set (LLVM_LIBS LLVM) -else (LLVM_LINK_LLVM_DYLIB) - set (LLVM_LIBS - Analysis - AsmParser - AsmPrinter - BitReader - BitWriter - CodeGen - Core - IRReader - InstCombine - Instrumentation - MC - MCDisassembler - MCParser - ObjCARCOpts - Object - Option - ProfileData - ScalarOpts - SelectionDAG - Support - Target - TransformUtils - Vectorize - X86AsmParser - X86AsmPrinter - X86CodeGen - X86Desc - X86Disassembler - X86Info - X86Utils) -endif (LLVM_LINK_LLVM_DYLIB) - -set(ADDITIONAL_LIBS ) +set(ADDITIONAL_LIBS ${CMAKE_DL_LIBS}) -if(USE_PREBUILT_LLVM AND NOT LLVMSPIRV_INCLUDED_IN_LLVM) +if(NOT LLVMSPIRVLib IN_LIST LLVM_AVAILABLE_LIBS) # SPIRV-LLVM-Translator is not included into LLVM as a component. - # So, we need to list it there explicitly as a library - set(ADDITIONAL_LIBS ${ADDITIONAL_LIBS} LLVMSPIRVLib) -elseif(NOT LLVM_LINK_LLVM_DYLIB) - # SPIRV-LLVM-Translator is included into LLVM as a component, but - # LLVM components is not linked together into an umbrella library. - # So, we need to list SPIRV-LLVM-Translator there explicitly as a component - set(LLVM_LIBS ${LLVM_LIBS} SPIRVLib) -endif(USE_PREBUILT_LLVM AND NOT LLVMSPIRV_INCLUDED_IN_LLVM) + # So, we need to list it here explicitly as an external library + list(APPEND ADDITIONAL_LIBS LLVMSPIRVLib) +endif() add_subdirectory(cl_headers) @@ -235,7 +194,7 @@ add_llvm_library(${TARGET_NAME} SHARED DEPENDS CClangCompileOptions LINK_COMPONENTS - ${LLVM_LIBS} + all LINK_LIBS # The list of clang libraries is taken from clang makefile # (build/tools/clang/tools/driver/CMakeFiles/clang.dir/link.txt) @@ -269,7 +228,7 @@ add_llvm_library(${TARGET_NAME} SHARED clangLex clangBasic ${ADDITIONAL_LIBS} - ${CMAKE_DL_LIBS}) + ) # Configure resource file on Windows if (WIN32) @@ -303,6 +262,9 @@ if (WIN32) "RC_PRODUCT_NAME=\"${RC_PRODUCT_NAME}\"" "RC_PRODUCT_VERSION=\"${RC_FILE_VERSION}\"" "RC_COPYRIGHT=\"Copyright ${RC_CHAR_C} 2018 Intel Corporation. All rights reserved.\"") +elseif(UNIX) + set_property(TARGET ${TARGET_NAME} APPEND_STRING PROPERTY + LINK_FLAGS " -Wl,--no-undefined") endif(WIN32) install(FILES common_clang.h