xref: /aosp_15_r20/external/llvm/tools/lto/CMakeLists.txt (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Workerset(LLVM_LINK_COMPONENTS
2*9880d681SAndroid Build Coastguard Worker  ${LLVM_TARGETS_TO_BUILD}
3*9880d681SAndroid Build Coastguard Worker  BitReader
4*9880d681SAndroid Build Coastguard Worker  Core
5*9880d681SAndroid Build Coastguard Worker  LTO
6*9880d681SAndroid Build Coastguard Worker  MC
7*9880d681SAndroid Build Coastguard Worker  MCDisassembler
8*9880d681SAndroid Build Coastguard Worker  Support
9*9880d681SAndroid Build Coastguard Worker  Target
10*9880d681SAndroid Build Coastguard Worker  )
11*9880d681SAndroid Build Coastguard Worker
12*9880d681SAndroid Build Coastguard Workerset(SOURCES
13*9880d681SAndroid Build Coastguard Worker  LTODisassembler.cpp
14*9880d681SAndroid Build Coastguard Worker  lto.cpp
15*9880d681SAndroid Build Coastguard Worker  )
16*9880d681SAndroid Build Coastguard Worker
17*9880d681SAndroid Build Coastguard Workerset(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/lto.exports)
18*9880d681SAndroid Build Coastguard Worker
19*9880d681SAndroid Build Coastguard Workeradd_llvm_library(LTO SHARED ${SOURCES})
20*9880d681SAndroid Build Coastguard Worker
21*9880d681SAndroid Build Coastguard Workerinstall(FILES ${LLVM_MAIN_INCLUDE_DIR}/llvm-c/lto.h
22*9880d681SAndroid Build Coastguard Worker  DESTINATION include/llvm-c
23*9880d681SAndroid Build Coastguard Worker  COMPONENT LTO)
24*9880d681SAndroid Build Coastguard Worker
25*9880d681SAndroid Build Coastguard Workerif (APPLE)
26*9880d681SAndroid Build Coastguard Worker  set(LTO_VERSION ${LLVM_VERSION_MAJOR})
27*9880d681SAndroid Build Coastguard Worker  if(LLVM_LTO_VERSION_OFFSET)
28*9880d681SAndroid Build Coastguard Worker    math(EXPR LTO_VERSION "${LLVM_VERSION_MAJOR} + ${LLVM_LTO_VERSION_OFFSET}")
29*9880d681SAndroid Build Coastguard Worker  endif()
30*9880d681SAndroid Build Coastguard Worker  set_property(TARGET LTO APPEND_STRING PROPERTY
31*9880d681SAndroid Build Coastguard Worker              LINK_FLAGS
32*9880d681SAndroid Build Coastguard Worker              " -compatibility_version 1 -current_version ${LTO_VERSION}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}")
33*9880d681SAndroid Build Coastguard Workerendif()
34