1include(LLVMParseArguments)
2
3# Link a shared library with COMPILER_RT_TEST_COMPILER.
4# clang_link_shared(<output.so>
5#                   OBJECTS <list of input objects>
6#                   LINKFLAGS <list of link flags>
7#                   DEPS <list of dependencies>)
8macro(clang_link_shared so_file)
9  parse_arguments(SOURCE "OBJECTS;LINKFLAGS;DEPS" "" ${ARGN})
10  if(NOT COMPILER_RT_STANDALONE_BUILD)
11    list(APPEND SOURCE_DEPS clang)
12  endif()
13  add_custom_command(
14    OUTPUT ${so_file}
15    COMMAND ${COMPILER_RT_TEST_COMPILER} -o "${so_file}" -shared
16            ${SOURCE_LINKFLAGS} ${SOURCE_OBJECTS}
17    DEPENDS ${SOURCE_DEPS})
18endmacro()
19