xref: /llvm-project/bolt/cmake/modules/AddBOLT.cmake (revision c5a3f664fe3b95df8fc623df21a50793e50db468)
1include(GNUInstallDirs)
2include(LLVMDistributionSupport)
3
4macro(add_bolt_executable name)
5  add_llvm_executable(${name} ${ARGN})
6endmacro()
7
8macro(add_bolt_tool name)
9  if (NOT BOLT_BUILD_TOOLS)
10    set(EXCLUDE_FROM_ALL ON)
11  endif()
12
13  add_bolt_executable(${name} ${ARGN})
14
15  if (BOLT_BUILD_TOOLS)
16    get_target_export_arg(${name} BOLT export_to_bolttargets)
17    install(TARGETS ${name}
18      ${export_to_bolttargets}
19      RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
20      COMPONENT bolt)
21
22    if(NOT LLVM_ENABLE_IDE)
23      add_llvm_install_targets(install-${name}
24                               DEPENDS ${name}
25                               COMPONENT bolt)
26    endif()
27    set_property(GLOBAL APPEND PROPERTY BOLT_EXPORTS ${name})
28  endif()
29endmacro()
30
31macro(add_bolt_tool_symlink name dest)
32  llvm_add_tool_symlink(BOLT ${name} ${dest} ALWAYS_GENERATE)
33  # Always generate install targets
34  llvm_install_symlink(BOLT ${name} ${dest} ALWAYS_GENERATE COMPONENT bolt)
35endmacro()
36