[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / lld / cmake / modules / AddLLD.cmake
blobd3924f7243d4039df9c448510f9083104e5826ea
1 include(GNUInstallDirs)
2 include(LLVMDistributionSupport)
4 macro(add_lld_library name)
5   cmake_parse_arguments(ARG
6     "SHARED"
7     ""
8     ""
9     ${ARGN})
10   if(ARG_SHARED)
11     set(ARG_ENABLE_SHARED SHARED)
12   endif()
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}
19       COMPONENT ${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}
27         DEPENDS ${name}
28         COMPONENT ${name})
29     endif()
30     set_property(GLOBAL APPEND PROPERTY LLD_EXPORTS ${name})
31   endif()
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)
42   endif()
44   add_lld_executable(${name} ${ARGN})
46   if (LLD_BUILD_TOOLS)
47     get_target_export_arg(${name} LLD export_to_lldtargets)
48     install(TARGETS ${name}
49       ${export_to_lldtargets}
50       RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
51       COMPONENT ${name})
53     if(NOT CMAKE_CONFIGURATION_TYPES)
54       add_llvm_install_targets(install-${name}
55         DEPENDS ${name}
56         COMPONENT ${name})
57     endif()
58     set_property(GLOBAL APPEND PROPERTY LLD_EXPORTS ${name})
59   endif()
60 endmacro()
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)
66 endmacro()