[clang-tools-extra] Prevent linking to duplicate .a libs and dylib
[lldb.git] / clang-tools-extra / clangd / unittests / CMakeLists.txt
1 set(LLVM_LINK_COMPONENTS
2   support
3   AllTargetsInfos
4   FrontendOpenMP
5   )
6
7 get_filename_component(CLANGD_SOURCE_DIR
8   ${CMAKE_CURRENT_SOURCE_DIR}/../../clangd REALPATH)
9 get_filename_component(CLANGD_BINARY_DIR
10   ${CMAKE_CURRENT_BINARY_DIR}/../../clangd REALPATH)
11 include_directories(
12   ${CLANGD_SOURCE_DIR}
13   ${CLANGD_BINARY_DIR}
14   )
15
16 if(CLANG_BUILT_STANDALONE)
17   # LLVMTestingSupport library is needed for clangd tests.
18   if (EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Testing/Support
19       AND NOT TARGET LLVMTestingSupport)
20     add_subdirectory(${LLVM_MAIN_SRC_DIR}/lib/Testing/Support
21       lib/Testing/Support)
22   endif()
23 endif()
24
25 if (CLANGD_ENABLE_REMOTE)
26   include_directories(${CMAKE_CURRENT_BINARY_DIR}/../index/remote)
27   add_definitions(-DGOOGLE_PROTOBUF_NO_RTTI=1)
28   set(REMOTE_TEST_SOURCES remote/MarshallingTests.cpp)
29 endif()
30
31 add_custom_target(ClangdUnitTests)
32 add_unittest(ClangdUnitTests ClangdTests
33   Annotations.cpp
34   ASTTests.cpp
35   BackgroundIndexTests.cpp
36   CanonicalIncludesTests.cpp
37   ClangdTests.cpp
38   ClangdLSPServerTests.cpp
39   CodeCompleteTests.cpp
40   CodeCompletionStringsTests.cpp
41   CollectMacrosTests.cpp
42   CompileCommandsTests.cpp
43   CompilerTests.cpp
44   DexTests.cpp
45   DiagnosticsTests.cpp
46   DraftStoreTests.cpp
47   ExpectedTypeTest.cpp
48   FileDistanceTests.cpp
49   FileIndexTests.cpp
50   FindSymbolsTests.cpp
51   FindTargetTests.cpp
52   FormatTests.cpp
53   FSTests.cpp
54   FuzzyMatchTests.cpp
55   GlobalCompilationDatabaseTests.cpp
56   HeadersTests.cpp
57   HeaderSourceSwitchTests.cpp
58   HoverTests.cpp
59   IndexActionTests.cpp
60   IndexTests.cpp
61   JSONTransportTests.cpp
62   LSPClient.cpp
63   ParsedASTTests.cpp
64   PathMappingTests.cpp
65   PreambleTests.cpp
66   PrintASTTests.cpp
67   QualityTests.cpp
68   RenameTests.cpp
69   RIFFTests.cpp
70   SelectionTests.cpp
71   SemanticHighlightingTests.cpp
72   SemanticSelectionTests.cpp
73   SerializationTests.cpp
74   SourceCodeTests.cpp
75   SymbolCollectorTests.cpp
76   SymbolInfoTests.cpp
77   SyncAPI.cpp
78   TUSchedulerTests.cpp
79   TestFS.cpp
80   TestIndex.cpp
81   TestTU.cpp
82   TypeHierarchyTests.cpp
83   TweakTests.cpp
84   TweakTesting.cpp
85   URITests.cpp
86   XRefsTests.cpp
87
88   support/CancellationTests.cpp
89   support/ContextTests.cpp
90   support/FunctionTests.cpp
91   support/MarkupTests.cpp
92   support/ThreadingTests.cpp
93   support/TestTracer.cpp
94   support/TraceTests.cpp
95
96   ${REMOTE_TEST_SOURCES}
97
98   $<TARGET_OBJECTS:obj.clangDaemonTweaks>
99   )
100
101 clang_target_link_libraries(ClangdTests
102   PRIVATE
103   clangAST
104   clangASTMatchers
105   clangBasic
106   clangFormat
107   clangFrontend
108   clangIndex
109   clangLex
110   clangSema
111   clangSerialization
112   clangTooling
113   clangToolingCore
114   clangToolingInclusions
115   clangToolingRefactoring
116   clangToolingSyntax
117   )
118 target_link_libraries(ClangdTests
119   PRIVATE
120   clangDaemon
121   clangdSupport
122   clangTidy
123   LLVMTestingSupport
124   )
125
126 if (CLANGD_ENABLE_REMOTE)
127   target_link_libraries(ClangdTests
128     PRIVATE
129     clangdRemoteMarshalling)
130 endif()
131
132 if (CLANGD_BUILD_XPC)
133   add_subdirectory(xpc)
134 endif ()
135
136 configure_lit_site_cfg(
137   ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
138   ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py)