1 include(GNUInstallDirs)
2 include(LLVMDistributionSupport)
4 macro(add_lld_library name)
5 cmake_parse_arguments(ARG
11 set(ARG_ENABLE_SHARED SHARED)
13 llvm_add_library(${name} ${ARG_ENABLE_SHARED} ${ARG_UNPARSED_ARGUMENTS})
14 set_target_properties(${name} PROPERTIES FOLDER "lld libraries")
16 if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
17 get_target_export_arg(${name} LLD export_to_lldtargets)
18 install(TARGETS ${name}
20 ${export_to_lldtargets}
21 LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
22 ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
23 RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
25 if (${ARG_SHARED} AND NOT CMAKE_CONFIGURATION_TYPES)
26 add_llvm_install_targets(install-${name}
30 set_property(GLOBAL APPEND PROPERTY LLD_EXPORTS ${name})
32 endmacro(add_lld_library)
34 macro(add_lld_executable name)
35 add_llvm_executable(${name} ${ARGN})
36 set_target_properties(${name} PROPERTIES FOLDER "lld executables")
37 endmacro(add_lld_executable)
39 macro(add_lld_tool name)
40 if (NOT LLD_BUILD_TOOLS)
41 set(EXCLUDE_FROM_ALL ON)
44 add_lld_executable(${name} ${ARGN})
47 get_target_export_arg(${name} LLD export_to_lldtargets)
48 install(TARGETS ${name}
49 ${export_to_lldtargets}
50 RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
53 if(NOT CMAKE_CONFIGURATION_TYPES)
54 add_llvm_install_targets(install-${name}
58 set_property(GLOBAL APPEND PROPERTY LLD_EXPORTS ${name})
62 macro(add_lld_symlink name dest)
63 llvm_add_tool_symlink(LLD ${name} ${dest} ALWAYS_GENERATE)
64 # Always generate install targets
65 llvm_install_symlink(LLD ${name} ${dest} ALWAYS_GENERATE)