xref: /openbsd/gnu/llvm/llvm/tools/lto/CMakeLists.txt (revision d415bd75)
1set(LLVM_LINK_COMPONENTS
2  AllTargetsAsmParsers
3  AllTargetsCodeGens
4  AllTargetsDescs
5  AllTargetsDisassemblers
6  AllTargetsInfos
7  BitReader
8  Core
9  CodeGen
10  LTO
11  MC
12  MCDisassembler
13  Support
14  Target
15  )
16
17set(SOURCES
18  LTODisassembler.cpp
19  lto.cpp
20  )
21
22set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/lto.exports)
23
24if(CMAKE_SYSTEM_NAME STREQUAL AIX)
25    set(LTO_LIBRARY_TYPE MODULE)
26    set(LTO_LIBRARY_NAME libLTO)
27  else()
28    set(LTO_LIBRARY_TYPE SHARED)
29    set(LTO_LIBRARY_NAME LTO)
30endif()
31
32add_llvm_library(${LTO_LIBRARY_NAME} ${LTO_LIBRARY_TYPE} INSTALL_WITH_TOOLCHAIN
33    ${SOURCES} DEPENDS intrinsics_gen)
34
35install(FILES ${LLVM_MAIN_INCLUDE_DIR}/llvm-c/lto.h
36  DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/llvm-c"
37  COMPONENT LTO)
38
39if (APPLE)
40  set(LTO_VERSION ${LLVM_VERSION_MAJOR})
41  if(LLVM_LTO_VERSION_OFFSET)
42    math(EXPR LTO_VERSION "${LLVM_VERSION_MAJOR} + ${LLVM_LTO_VERSION_OFFSET}")
43  endif()
44  set_property(TARGET LTO APPEND_STRING PROPERTY
45              LINK_FLAGS
46              " -compatibility_version 1 -current_version ${LTO_VERSION}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}")
47endif()
48