unittests/CMakeLists.txt: Don't use RTTI, or linking failed.
[oota-llvm.git] / unittests / CMakeLists.txt
1 function(add_llvm_unittest test_name)
2   if (CMAKE_BUILD_TYPE)
3     set(CMAKE_RUNTIME_OUTPUT_DIRECTORY
4       ${LLVM_BINARY_DIR}/unittests/${test_name}/${CMAKE_BUILD_TYPE})
5   else()
6     set(CMAKE_RUNTIME_OUTPUT_DIRECTORY
7       ${LLVM_BINARY_DIR}/unittests/${test_name})
8   endif()
9   if( NOT LLVM_BUILD_TESTS )
10     set(EXCLUDE_FROM_ALL ON)
11   endif()
12   add_llvm_executable(${test_name}Tests ${ARGN})
13   add_dependencies(UnitTests ${test_name}Tests)
14 endfunction()
15
16 add_custom_target(UnitTests)
17
18 include_directories(${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest/include)
19 add_definitions(-DGTEST_HAS_RTTI=0)
20
21 set(LLVM_LINK_COMPONENTS
22   jit
23   interpreter
24   nativecodegen
25   BitWriter
26   BitReader
27   AsmParser
28   Core
29   System
30   Support
31   )
32
33 set(LLVM_USED_LIBS
34   gtest
35   gtest_main
36   )
37
38 add_llvm_unittest(ADT
39   ADT/APFloatTest.cpp
40   ADT/APIntTest.cpp
41   ADT/BitVectorTest.cpp
42   ADT/DAGDeltaAlgorithmTest.cpp
43   ADT/DeltaAlgorithmTest.cpp
44   ADT/DenseMapTest.cpp
45   ADT/DenseSetTest.cpp
46   ADT/ilistTest.cpp
47   ADT/ImmutableSetTest.cpp
48   ADT/SmallBitVectorTest.cpp
49   ADT/SmallStringTest.cpp
50   ADT/SmallVectorTest.cpp
51   ADT/SparseBitVectorTest.cpp
52   ADT/StringMapTest.cpp
53   ADT/StringRefTest.cpp
54   ADT/TripleTest.cpp
55   ADT/TwineTest.cpp
56  )
57
58 add_llvm_unittest(Analysis
59   Analysis/ScalarEvolutionTest.cpp
60   )
61
62 add_llvm_unittest(ExecutionEngine
63   ExecutionEngine/ExecutionEngineTest.cpp
64   )
65
66 add_llvm_unittest(JIT
67   ExecutionEngine/JIT/JITEventListenerTest.cpp
68   ExecutionEngine/JIT/JITMemoryManagerTest.cpp
69   ExecutionEngine/JIT/JITTest.cpp
70   ExecutionEngine/JIT/MultiJITTest.cpp
71   )
72
73 add_llvm_unittest(Transforms
74   Transforms/Utils/Cloning.cpp
75   )
76
77 add_llvm_unittest(VMCore
78   VMCore/ConstantsTest.cpp
79   VMCore/DerivedTypesTest.cpp
80   VMCore/InstructionsTest.cpp
81   VMCore/MetadataTest.cpp
82   VMCore/PassManagerTest.cpp
83   VMCore/VerifierTest.cpp
84   )
85
86 set(LLVM_LINK_COMPONENTS
87   System
88   Support
89   Core
90   )
91
92 add_llvm_unittest(Support
93   Support/AllocatorTest.cpp
94   Support/Casting.cpp
95   Support/CommandLineTest.cpp
96   Support/ConstantRangeTest.cpp
97   Support/EndianTest.cpp
98   Support/LeakDetectorTest.cpp
99   Support/MathExtrasTest.cpp
100   Support/raw_ostream_test.cpp
101   Support/RegexTest.cpp
102   Support/SwapByteOrderTest.cpp
103   Support/System.cpp
104   Support/TypeBuilderTest.cpp
105   Support/ValueHandleTest.cpp
106   )