1 # Needed by LLVM's CMake checks because this file defines multiple targets.
2 set(LLVM_OPTIONAL_SOURCES ExportedFuncs.cpp PipSqueak.cpp)
4 set(LLVM_LINK_COMPONENTS Support)
6 add_library(DynamicLibraryLib STATIC
9 set_target_properties(DynamicLibraryLib PROPERTIES FOLDER "Tests")
11 # extract_symbols.py relies on all its library arguments being in the same
12 # directory, so we must set the output directory in the same way as if
13 # add_llvm_library was used.
14 set_output_directory(DynamicLibraryLib
15 LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}
18 add_llvm_unittest(DynamicLibraryTests
19 DynamicLibraryTest.cpp
21 target_link_libraries(DynamicLibraryTests PRIVATE DynamicLibraryLib)
22 export_executable_symbols(DynamicLibraryTests)
24 function(dynlib_add_module NAME)
25 add_library(${NAME} SHARED
28 set_target_properties(${NAME} PROPERTIES FOLDER "Tests")
30 set_output_directory(${NAME}
31 BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}
32 LIBRARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}
35 set_target_properties(${NAME}
37 SUFFIX ${LTDL_SHLIB_EXT}
40 add_dependencies(DynamicLibraryTests ${NAME})
41 endfunction(dynlib_add_module)
43 # Revert -Wl,-z,nodelete on this test since it relies on the file
45 if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
46 string(REPLACE "-Wl,-z,nodelete" "" CMAKE_SHARED_LINKER_FLAGS
47 ${CMAKE_SHARED_LINKER_FLAGS})
50 dynlib_add_module(PipSqueak)
51 dynlib_add_module(SecondLib)