CMake: Build unittests.
[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 endfunction()
14
15 include_directories(${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest/include)
16
17 set(LLVM_LINK_COMPONENTS
18   jit
19   interpreter
20   nativecodegen
21   BitWriter
22   BitReader
23   AsmParser
24   Core
25   System
26   Support
27   )
28
29 set(LLVM_USED_LIBS
30   gtest
31   gtest_main
32   )
33
34 add_llvm_unittest(ADT
35   ADT/APFloatTest.cpp
36   ADT/APIntTest.cpp
37   ADT/BitVectorTest.cpp
38   ADT/DAGDeltaAlgorithmTest.cpp
39   ADT/DeltaAlgorithmTest.cpp
40   ADT/DenseMapTest.cpp
41   ADT/DenseSetTest.cpp
42   ADT/ilistTest.cpp
43   ADT/ImmutableSetTest.cpp
44   ADT/SmallBitVectorTest.cpp
45   ADT/SmallStringTest.cpp
46   ADT/SmallVectorTest.cpp
47   ADT/SparseBitVectorTest.cpp
48   ADT/StringMapTest.cpp
49   ADT/StringRefTest.cpp
50   ADT/TripleTest.cpp
51   ADT/TwineTest.cpp
52   ADT/ValueMapTest.cpp
53   )
54
55 add_llvm_unittest(Analysis
56   Analysis/ScalarEvolutionTest.cpp
57   )
58
59 add_llvm_unittest(ExecutionEngine
60   ExecutionEngine/ExecutionEngineTest.cpp
61   )
62
63 add_llvm_unittest(JIT
64   ExecutionEngine/JIT/JITEventListenerTest.cpp
65   ExecutionEngine/JIT/JITMemoryManagerTest.cpp
66   ExecutionEngine/JIT/JITTest.cpp
67   ExecutionEngine/JIT/MultiJITTest.cpp
68   )
69
70 add_llvm_unittest(Support
71   Support/AllocatorTest.cpp
72   Support/Casting.cpp
73   Support/CommandLineTest.cpp
74   Support/ConstantRangeTest.cpp
75   Support/LeakDetectorTest.cpp
76   Support/MathExtrasTest.cpp
77   Support/raw_ostream_test.cpp
78   Support/RegexTest.cpp
79   Support/System.cpp
80   Support/TypeBuilderTest.cpp
81   Support/ValueHandleTest.cpp
82   )
83
84 add_llvm_unittest(Transforms
85   Transforms/Utils/Cloning.cpp
86   )
87
88 add_llvm_unittest(VMCore
89   VMCore/ConstantsTest.cpp
90   VMCore/DerivedTypesTest.cpp
91   VMCore/InstructionsTest.cpp
92   VMCore/MetadataTest.cpp
93   VMCore/PassManagerTest.cpp
94   VMCore/VerifierTest.cpp
95   )