Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / openmp / libomptarget / src / CMakeLists.txt
blobbf6c23bd5eb5fe2f5efce0e741f45576fe066d41
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 # Build offloading library libomptarget.so.
11 ##===----------------------------------------------------------------------===##
13 libomptarget_say("Building offloading runtime library libomptarget.")
15 add_llvm_library(omptarget
16   SHARED
18   api.cpp
19   device.cpp
20   interface.cpp
21   interop.cpp
22   omptarget.cpp
23   OmptCallback.cpp
24   rtl.cpp
25   LegacyAPI.cpp
27   ADDITIONAL_HEADER_DIRS
28   ${LIBOMPTARGET_INCLUDE_DIR}
30   LINK_COMPONENTS
31   Support
32   Object
34   LINK_LIBS
35   PUBLIC
36   omp
38   NO_INSTALL_RPATH
40 target_include_directories(omptarget PRIVATE ${LIBOMPTARGET_INCLUDE_DIR})
42 if (LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
43   target_link_libraries(omptarget PRIVATE
44     "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/exports")
45 endif()
47 # libomptarget.so needs to be aware of where the plugins live as they
48 # are now separated in the build directory.
49 set_target_properties(omptarget PROPERTIES INSTALL_RPATH "$ORIGIN" BUILD_RPATH "$ORIGIN:${CMAKE_CURRENT_BINARY_DIR}/..")
50 install(TARGETS omptarget LIBRARY COMPONENT omptarget DESTINATION "${OPENMP_INSTALL_LIBDIR}")