1 function(add_llvm_unittest test_name)
3 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY
4 ${LLVM_BINARY_DIR}/unittests/${test_name}/${CMAKE_BUILD_TYPE})
6 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY
7 ${LLVM_BINARY_DIR}/unittests/${test_name})
9 if( NOT LLVM_BUILD_TESTS )
10 set(EXCLUDE_FROM_ALL ON)
12 add_llvm_executable(${test_name}Tests ${ARGN})
13 add_dependencies(UnitTests ${test_name}Tests)
16 add_custom_target(UnitTests)
18 include_directories(${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest/include)
19 add_definitions(-DGTEST_HAS_RTTI=0)
20 if (NOT LLVM_ENABLE_THREADS)
21 add_definitions(-DGTEST_HAS_PTHREAD=0)
24 set(LLVM_LINK_COMPONENTS
39 LLVMSupport # gtest needs it for raw_ostream.
46 ADT/DAGDeltaAlgorithmTest.cpp
47 ADT/DeltaAlgorithmTest.cpp
52 ADT/ImmutableSetTest.cpp
53 ADT/IntervalMapTest.cpp
54 ADT/SmallBitVectorTest.cpp
55 ADT/SmallStringTest.cpp
56 ADT/SmallVectorTest.cpp
57 ADT/SparseBitVectorTest.cpp
64 add_llvm_unittest(Analysis
65 Analysis/ScalarEvolutionTest.cpp
68 add_llvm_unittest(ExecutionEngine
69 ExecutionEngine/ExecutionEngineTest.cpp
73 ExecutionEngine/JIT/JITEventListenerTest.cpp
74 ExecutionEngine/JIT/JITMemoryManagerTest.cpp
75 ExecutionEngine/JIT/JITTest.cpp
76 ExecutionEngine/JIT/MultiJITTest.cpp
80 list(APPEND JITTestsSources ExecutionEngine/JIT/JITTests.def)
83 add_llvm_unittest(JIT ${JITTestsSources})
85 add_llvm_unittest(Transforms
86 Transforms/Utils/Cloning.cpp
90 VMCore/ConstantsTest.cpp
91 VMCore/DerivedTypesTest.cpp
92 VMCore/InstructionsTest.cpp
93 VMCore/MetadataTest.cpp
94 VMCore/PassManagerTest.cpp
95 VMCore/ValueMapTest.cpp
96 VMCore/VerifierTest.cpp
99 # MSVC9 and 8 cannot compile ValueMapTest.cpp due to their bug.
100 # See issue#331418 in Visual Studio.
101 if(MSVC AND MSVC_VERSION LESS 1600)
102 list(REMOVE_ITEM VMCoreSources VMCore/ValueMapTest.cpp)
105 add_llvm_unittest(VMCore ${VMCoreSources})
107 set(LLVM_LINK_COMPONENTS
113 add_llvm_unittest(Support
114 Support/AllocatorTest.cpp
116 Support/CommandLineTest.cpp
117 Support/ConstantRangeTest.cpp
118 Support/EndianTest.cpp
119 Support/LeakDetectorTest.cpp
120 Support/MathExtrasTest.cpp
121 Support/raw_ostream_test.cpp
122 Support/RegexTest.cpp
123 Support/SwapByteOrderTest.cpp
124 Support/TypeBuilderTest.cpp
125 Support/ValueHandleTest.cpp
128 set(LLVM_LINK_COMPONENTS
132 add_llvm_unittest(System