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
38 LLVMSupport # gtest needs it for raw_ostream.
45 ADT/DAGDeltaAlgorithmTest.cpp
46 ADT/DeltaAlgorithmTest.cpp
51 ADT/ImmutableSetTest.cpp
52 ADT/IntervalMapTest.cpp
53 ADT/SmallBitVectorTest.cpp
54 ADT/SmallStringTest.cpp
55 ADT/SmallVectorTest.cpp
56 ADT/SparseBitVectorTest.cpp
63 add_llvm_unittest(Analysis
64 Analysis/ScalarEvolutionTest.cpp
67 add_llvm_unittest(ExecutionEngine
68 ExecutionEngine/ExecutionEngineTest.cpp
72 ExecutionEngine/JIT/JITEventListenerTest.cpp
73 ExecutionEngine/JIT/JITMemoryManagerTest.cpp
74 ExecutionEngine/JIT/JITTest.cpp
75 ExecutionEngine/JIT/MultiJITTest.cpp
79 list(APPEND JITTestsSources ExecutionEngine/JIT/JITTests.def)
82 add_llvm_unittest(JIT ${JITTestsSources})
85 set_property(TARGET JITTests PROPERTY LINK_FLAGS -Wl,--export-all-symbols)
88 add_llvm_unittest(Transforms
89 Transforms/Utils/Cloning.cpp
93 VMCore/ConstantsTest.cpp
94 VMCore/DerivedTypesTest.cpp
95 VMCore/InstructionsTest.cpp
96 VMCore/MetadataTest.cpp
97 VMCore/PassManagerTest.cpp
98 VMCore/ValueMapTest.cpp
99 VMCore/VerifierTest.cpp
102 # MSVC9 and 8 cannot compile ValueMapTest.cpp due to their bug.
103 # See issue#331418 in Visual Studio.
104 if(MSVC AND MSVC_VERSION LESS 1600)
105 list(REMOVE_ITEM VMCoreSources VMCore/ValueMapTest.cpp)
108 add_llvm_unittest(VMCore ${VMCoreSources})
110 set(LLVM_LINK_COMPONENTS
115 add_llvm_unittest(Support
116 Support/AllocatorTest.cpp
118 Support/CommandLineTest.cpp
119 Support/ConstantRangeTest.cpp
120 Support/EndianTest.cpp
121 Support/LeakDetectorTest.cpp
122 Support/MathExtrasTest.cpp
124 Support/raw_ostream_test.cpp
125 Support/RegexTest.cpp
126 Support/SwapByteOrderTest.cpp
127 Support/TimeValue.cpp
128 Support/TypeBuilderTest.cpp
129 Support/ValueHandleTest.cpp