2021-12-30 14:22:48 +08:00
|
|
|
include(GNUInstallDirs)
|
2020-10-02 05:35:28 +08:00
|
|
|
include(LLVMDistributionSupport)
|
|
|
|
|
2016-12-23 08:22:47 +08:00
|
|
|
macro(add_lld_library name)
|
2017-01-24 18:41:02 +08:00
|
|
|
cmake_parse_arguments(ARG
|
|
|
|
"SHARED"
|
|
|
|
""
|
|
|
|
""
|
|
|
|
${ARGN})
|
|
|
|
if(ARG_SHARED)
|
|
|
|
set(ARG_ENABLE_SHARED SHARED)
|
|
|
|
endif()
|
|
|
|
llvm_add_library(${name} ${ARG_ENABLE_SHARED} ${ARG_UNPARSED_ARGUMENTS})
|
2016-12-23 08:22:47 +08:00
|
|
|
set_target_properties(${name} PROPERTIES FOLDER "lld libraries")
|
2017-01-24 18:41:02 +08:00
|
|
|
|
2018-03-09 21:09:36 +08:00
|
|
|
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
|
2020-10-02 05:35:28 +08:00
|
|
|
get_target_export_arg(${name} LLD export_to_lldtargets)
|
2017-01-24 18:41:02 +08:00
|
|
|
install(TARGETS ${name}
|
|
|
|
COMPONENT ${name}
|
|
|
|
${export_to_lldtargets}
|
|
|
|
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
|
|
|
|
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
|
2021-12-30 14:22:48 +08:00
|
|
|
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
2017-01-24 18:41:02 +08:00
|
|
|
|
|
|
|
if (${ARG_SHARED} AND NOT CMAKE_CONFIGURATION_TYPES)
|
2017-12-01 12:17:45 +08:00
|
|
|
add_llvm_install_targets(install-${name}
|
2017-01-24 18:41:02 +08:00
|
|
|
DEPENDS ${name}
|
2017-12-01 12:17:45 +08:00
|
|
|
COMPONENT ${name})
|
2017-01-24 18:41:02 +08:00
|
|
|
endif()
|
|
|
|
set_property(GLOBAL APPEND PROPERTY LLD_EXPORTS ${name})
|
|
|
|
endif()
|
2016-12-23 08:22:47 +08:00
|
|
|
endmacro(add_lld_library)
|
|
|
|
|
|
|
|
macro(add_lld_executable name)
|
|
|
|
add_llvm_executable(${name} ${ARGN})
|
|
|
|
set_target_properties(${name} PROPERTIES FOLDER "lld executables")
|
|
|
|
endmacro(add_lld_executable)
|
|
|
|
|
|
|
|
macro(add_lld_tool name)
|
|
|
|
if (NOT LLD_BUILD_TOOLS)
|
|
|
|
set(EXCLUDE_FROM_ALL ON)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
add_lld_executable(${name} ${ARGN})
|
|
|
|
|
|
|
|
if (LLD_BUILD_TOOLS)
|
2020-10-02 05:35:28 +08:00
|
|
|
get_target_export_arg(${name} LLD export_to_lldtargets)
|
2016-12-23 08:22:47 +08:00
|
|
|
install(TARGETS ${name}
|
|
|
|
${export_to_lldtargets}
|
2021-12-30 14:22:48 +08:00
|
|
|
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
2016-12-23 08:22:47 +08:00
|
|
|
COMPONENT ${name})
|
|
|
|
|
|
|
|
if(NOT CMAKE_CONFIGURATION_TYPES)
|
2017-12-01 12:17:45 +08:00
|
|
|
add_llvm_install_targets(install-${name}
|
2016-12-23 08:22:47 +08:00
|
|
|
DEPENDS ${name}
|
2017-12-01 12:17:45 +08:00
|
|
|
COMPONENT ${name})
|
2016-12-23 08:22:47 +08:00
|
|
|
endif()
|
|
|
|
set_property(GLOBAL APPEND PROPERTY LLD_EXPORTS ${name})
|
|
|
|
endif()
|
|
|
|
endmacro()
|
|
|
|
|
|
|
|
macro(add_lld_symlink name dest)
|
|
|
|
add_llvm_tool_symlink(${name} ${dest} ALWAYS_GENERATE)
|
|
|
|
# Always generate install targets
|
|
|
|
llvm_install_symlink(${name} ${dest} ALWAYS_GENERATE)
|
|
|
|
endmacro()
|