Petr Hosek | f367a2a | 2016-12-23 00:22:47 +0000 | [diff] [blame^] | 1 | macro(add_lld_library name) |
| 2 | add_llvm_library(${name} ${ARGN}) |
| 3 | set_target_properties(${name} PROPERTIES FOLDER "lld libraries") |
| 4 | endmacro(add_lld_library) |
| 5 | |
| 6 | macro(add_lld_executable name) |
| 7 | add_llvm_executable(${name} ${ARGN}) |
| 8 | set_target_properties(${name} PROPERTIES FOLDER "lld executables") |
| 9 | endmacro(add_lld_executable) |
| 10 | |
| 11 | macro(add_lld_tool name) |
| 12 | if (NOT LLD_BUILD_TOOLS) |
| 13 | set(EXCLUDE_FROM_ALL ON) |
| 14 | endif() |
| 15 | |
| 16 | add_lld_executable(${name} ${ARGN}) |
| 17 | |
| 18 | if (LLD_BUILD_TOOLS) |
| 19 | if(${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR |
| 20 | NOT LLVM_DISTRIBUTION_COMPONENTS) |
| 21 | set(export_to_lldtargets EXPORT lldTargets) |
| 22 | set_property(GLOBAL PROPERTY LLD_HAS_EXPORTS True) |
| 23 | endif() |
| 24 | |
| 25 | install(TARGETS ${name} |
| 26 | ${export_to_lldtargets} |
| 27 | RUNTIME DESTINATION bin |
| 28 | COMPONENT ${name}) |
| 29 | |
| 30 | if(NOT CMAKE_CONFIGURATION_TYPES) |
| 31 | add_custom_target(install-${name} |
| 32 | DEPENDS ${name} |
| 33 | COMMAND "${CMAKE_COMMAND}" |
| 34 | -DCMAKE_INSTALL_COMPONENT=${name} |
| 35 | -P "${CMAKE_BINARY_DIR}/cmake_install.cmake") |
| 36 | endif() |
| 37 | set_property(GLOBAL APPEND PROPERTY LLD_EXPORTS ${name}) |
| 38 | endif() |
| 39 | endmacro() |
| 40 | |
| 41 | macro(add_lld_symlink name dest) |
| 42 | add_llvm_tool_symlink(${name} ${dest} ALWAYS_GENERATE) |
| 43 | # Always generate install targets |
| 44 | llvm_install_symlink(${name} ${dest} ALWAYS_GENERATE) |
| 45 | endmacro() |