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 # NOTE: Don't try to build `elf_common` using `add_llvm_library`.
14 # See openmp/libomptarget/plugins/common/PluginInterface/CMakeLists.txt
15 # for more explanation.
16 add_library(elf_common OBJECT elf_common.cpp ELFSymbols.cpp)
18 # This is required when using LLVM libraries.
19 llvm_update_compile_flags(elf_common)
21 if (LLVM_LINK_LLVM_DYLIB)
24 llvm_map_components_to_libnames(llvm_libs BinaryFormat Object Support)
27 target_link_libraries(elf_common PUBLIC ${llvm_libs} ${OPENMP_PTHREAD_LIB})
29 # Build elf_common with PIC to be able to link it with plugin shared libraries.
30 set_property(TARGET elf_common PROPERTY POSITION_INDEPENDENT_CODE ON)
32 # Expose elf_common.h directory to the users of this library.
33 target_include_directories(elf_common
34 INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}
35 PRIVATE ${LIBOMPTARGET_INCLUDE_DIR}