1*dfe94b16Srobertinclude(GNUInstallDirs) 21cf9926bSpatrickinclude(LLVMDistributionSupport) 31cf9926bSpatrick 4ece8a530Spatrickmacro(add_lld_library name) 5ece8a530Spatrick cmake_parse_arguments(ARG 6ece8a530Spatrick "SHARED" 7ece8a530Spatrick "" 8ece8a530Spatrick "" 9ece8a530Spatrick ${ARGN}) 10ece8a530Spatrick if(ARG_SHARED) 11ece8a530Spatrick set(ARG_ENABLE_SHARED SHARED) 12ece8a530Spatrick endif() 13ece8a530Spatrick llvm_add_library(${name} ${ARG_ENABLE_SHARED} ${ARG_UNPARSED_ARGUMENTS}) 14ece8a530Spatrick set_target_properties(${name} PROPERTIES FOLDER "lld libraries") 15ece8a530Spatrick 16ece8a530Spatrick if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) 171cf9926bSpatrick get_target_export_arg(${name} LLD export_to_lldtargets) 18ece8a530Spatrick install(TARGETS ${name} 19ece8a530Spatrick COMPONENT ${name} 20ece8a530Spatrick ${export_to_lldtargets} 21ece8a530Spatrick LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} 22ece8a530Spatrick ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} 23*dfe94b16Srobert RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") 24ece8a530Spatrick 25ece8a530Spatrick if (${ARG_SHARED} AND NOT CMAKE_CONFIGURATION_TYPES) 26ece8a530Spatrick add_llvm_install_targets(install-${name} 27ece8a530Spatrick DEPENDS ${name} 28ece8a530Spatrick COMPONENT ${name}) 29ece8a530Spatrick endif() 30ece8a530Spatrick set_property(GLOBAL APPEND PROPERTY LLD_EXPORTS ${name}) 31ece8a530Spatrick endif() 32ece8a530Spatrickendmacro(add_lld_library) 33ece8a530Spatrick 34ece8a530Spatrickmacro(add_lld_executable name) 35ece8a530Spatrick add_llvm_executable(${name} ${ARGN}) 36ece8a530Spatrick set_target_properties(${name} PROPERTIES FOLDER "lld executables") 37ece8a530Spatrickendmacro(add_lld_executable) 38ece8a530Spatrick 39ece8a530Spatrickmacro(add_lld_tool name) 40ece8a530Spatrick if (NOT LLD_BUILD_TOOLS) 41ece8a530Spatrick set(EXCLUDE_FROM_ALL ON) 42ece8a530Spatrick endif() 43ece8a530Spatrick 44ece8a530Spatrick add_lld_executable(${name} ${ARGN}) 45ece8a530Spatrick 46ece8a530Spatrick if (LLD_BUILD_TOOLS) 471cf9926bSpatrick get_target_export_arg(${name} LLD export_to_lldtargets) 48ece8a530Spatrick install(TARGETS ${name} 49ece8a530Spatrick ${export_to_lldtargets} 50*dfe94b16Srobert RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" 51ece8a530Spatrick COMPONENT ${name}) 52ece8a530Spatrick 53ece8a530Spatrick if(NOT CMAKE_CONFIGURATION_TYPES) 54ece8a530Spatrick add_llvm_install_targets(install-${name} 55ece8a530Spatrick DEPENDS ${name} 56ece8a530Spatrick COMPONENT ${name}) 57ece8a530Spatrick endif() 58ece8a530Spatrick set_property(GLOBAL APPEND PROPERTY LLD_EXPORTS ${name}) 59ece8a530Spatrick endif() 60ece8a530Spatrickendmacro() 61ece8a530Spatrick 62ece8a530Spatrickmacro(add_lld_symlink name dest) 63*dfe94b16Srobert llvm_add_tool_symlink(LLD ${name} ${dest} ALWAYS_GENERATE) 64ece8a530Spatrick # Always generate install targets 65*dfe94b16Srobert llvm_install_symlink(LLD ${name} ${dest} ALWAYS_GENERATE) 66ece8a530Spatrickendmacro() 67