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)
21 set(LLVM_LINK_COMPONENTS
42 ADT/DAGDeltaAlgorithmTest.cpp
43 ADT/DeltaAlgorithmTest.cpp
47 ADT/ImmutableSetTest.cpp
48 ADT/SmallBitVectorTest.cpp
49 ADT/SmallStringTest.cpp
50 ADT/SmallVectorTest.cpp
51 ADT/SparseBitVectorTest.cpp
58 add_llvm_unittest(Analysis
59 Analysis/ScalarEvolutionTest.cpp
62 add_llvm_unittest(ExecutionEngine
63 ExecutionEngine/ExecutionEngineTest.cpp
67 ExecutionEngine/JIT/JITEventListenerTest.cpp
68 ExecutionEngine/JIT/JITMemoryManagerTest.cpp
69 ExecutionEngine/JIT/JITTest.cpp
70 ExecutionEngine/JIT/MultiJITTest.cpp
74 list(APPEND JITTestsSources ExecutionEngine/JIT/JITTests.def)
77 add_llvm_unittest(JIT ${JITTestsSources})
79 add_llvm_unittest(Transforms
80 Transforms/Utils/Cloning.cpp
84 VMCore/ConstantsTest.cpp
85 VMCore/DerivedTypesTest.cpp
86 VMCore/InstructionsTest.cpp
87 VMCore/MetadataTest.cpp
88 VMCore/PassManagerTest.cpp
89 VMCore/ValueMapTest.cpp
90 VMCore/VerifierTest.cpp
93 # MSVC9 and 8 cannot compile ValueMapTest.cpp due to their bug.
94 # See issue#331418 in Visual Studio.
95 if(MSVC AND MSVC_VERSION LESS 1600)
96 list(REMOVE_ITEM VMCoreSources VMCore/ValueMapTest.cpp)
99 add_llvm_unittest(VMCore ${VMCoreSources})
101 set(LLVM_LINK_COMPONENTS
107 add_llvm_unittest(Support
108 Support/AllocatorTest.cpp
110 Support/CommandLineTest.cpp
111 Support/ConstantRangeTest.cpp
112 Support/EndianTest.cpp
113 Support/LeakDetectorTest.cpp
114 Support/MathExtrasTest.cpp
115 Support/raw_ostream_test.cpp
116 Support/RegexTest.cpp
117 Support/SwapByteOrderTest.cpp
119 Support/TypeBuilderTest.cpp
120 Support/ValueHandleTest.cpp