Steven Wu 01b488faab
Reapply "[CMake] Fold export_executable_symbols_* into function args. (#101741)" (#102138)
Fix the builds with LLVM_TOOL_LLVM_DRIVER_BUILD enabled.

LLVM_ENABLE_EXPORTED_SYMBOLS_IN_EXECUTABLES is not completely
compatible with export_executable_symbols as the later will be ignored
if the previous is set to NO.

Fix the issue by passing if symbols need to be exported to
llvm_add_exectuable so the link flag can be determined directly
without calling export_executable_symbols_* later.
2024-08-07 09:12:15 -07:00

45 lines
751 B
CMake

set(LLVM_LINK_COMPONENTS
${LLVM_TARGETS_TO_BUILD}
BitWriter
Core
BinaryFormat
MC
Target
TransformUtils
Analysis
Passes
IRReader
Object
Option
Support
TargetParser
CodeGen
LTO
FrontendOffloading
)
set(LLVM_TARGET_DEFINITIONS LinkerWrapperOpts.td)
tablegen(LLVM LinkerWrapperOpts.inc -gen-opt-parser-defs)
add_public_tablegen_target(LinkerWrapperOpts)
if(NOT CLANG_BUILT_STANDALONE)
set(tablegen_deps intrinsics_gen LinkerWrapperOpts)
endif()
add_clang_tool(clang-linker-wrapper
ClangLinkerWrapper.cpp
DEPENDS
${tablegen_deps}
EXPORT_SYMBOLS_FOR_PLUGINS
)
set(CLANG_LINKER_WRAPPER_LIB_DEPS
clangBasic
)
target_link_libraries(clang-linker-wrapper
PRIVATE
${CLANG_LINKER_WRAPPER_LIB_DEPS}
)