1 ##===----------------------------------------------------------------------===##
3 # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 # See https://llvm.org/LICENSE.txt for license information.
5 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 ##===----------------------------------------------------------------------===##
9 # Common ELF functionality for target plugins
11 ##===----------------------------------------------------------------------===##
13 add_library(elf_common OBJECT elf_common.cpp)
15 # Build elf_common with PIC to be able to link it with plugin shared libraries.
16 set_property(TARGET elf_common PROPERTY POSITION_INDEPENDENT_CODE ON)
17 llvm_update_compile_flags(elf_common)
18 set(LINK_LLVM_LIBS LLVMBinaryFormat LLVMObject LLVMSupport)
19 if (LLVM_LINK_LLVM_DYLIB)
20 set(LINK_LLVM_LIBS LLVM)
22 target_link_libraries(elf_common INTERFACE ${LINK_LLVM_LIBS})
23 include_directories(${LIBOMPTARGET_LLVM_INCLUDE_DIRS})
24 add_dependencies(elf_common ${LINK_LLVM_LIBS})
26 # The code uses Debug.h, which requires threads support.
27 target_link_libraries(elf_common INTERFACE ${OPENMP_PTHREAD_LIB})
29 # Expose elf_common.h directory to the users of this library.
30 target_include_directories(elf_common INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})