1 function(add_llvm_unittest test_dirname)
2 string(REGEX MATCH "([^/]+)$" test_name ${test_dirname})
4 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY
5 ${LLVM_BINARY_DIR}/unittests/${test_dirname}/${CMAKE_BUILD_TYPE})
7 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY
8 ${LLVM_BINARY_DIR}/unittests/${test_dirname})
10 if( NOT LLVM_BUILD_TESTS )
11 set(EXCLUDE_FROM_ALL ON)
13 add_llvm_executable(${test_name}Tests ${ARGN})
14 add_dependencies(UnitTests ${test_name}Tests)
17 add_custom_target(UnitTests)
19 include_directories(${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest/include)
20 add_definitions(-DGTEST_HAS_RTTI=0)
21 if (NOT LLVM_ENABLE_THREADS)
22 add_definitions(-DGTEST_HAS_PTHREAD=0)
25 if(SUPPORTS_NO_VARIADIC_MACROS_FLAG)
26 add_definitions("-Wno-variadic-macros")
29 set(LLVM_LINK_COMPONENTS
43 LLVMSupport # gtest needs it for raw_ostream.
50 ADT/DAGDeltaAlgorithmTest.cpp
51 ADT/DeltaAlgorithmTest.cpp
56 ADT/ImmutableSetTest.cpp
57 ADT/IntEqClassesTest.cpp
58 ADT/IntervalMapTest.cpp
59 ADT/SmallBitVectorTest.cpp
60 ADT/SmallStringTest.cpp
61 ADT/SmallVectorTest.cpp
62 ADT/SparseBitVectorTest.cpp
69 add_llvm_unittest(Analysis
70 Analysis/ScalarEvolutionTest.cpp
73 add_llvm_unittest(ExecutionEngine
74 ExecutionEngine/ExecutionEngineTest.cpp
78 ExecutionEngine/JIT/JITEventListenerTest.cpp
79 ExecutionEngine/JIT/JITMemoryManagerTest.cpp
80 ExecutionEngine/JIT/JITTest.cpp
81 ExecutionEngine/JIT/MultiJITTest.cpp
85 list(APPEND JITTestsSources ExecutionEngine/JIT/JITTests.def)
88 add_llvm_unittest(ExecutionEngine/JIT ${JITTestsSources})
91 set_property(TARGET JITTests PROPERTY LINK_FLAGS -Wl,--export-all-symbols)
94 add_llvm_unittest(Transforms/Utils
95 Transforms/Utils/Cloning.cpp
99 VMCore/ConstantsTest.cpp
100 VMCore/DerivedTypesTest.cpp
101 VMCore/InstructionsTest.cpp
102 VMCore/MetadataTest.cpp
103 VMCore/PassManagerTest.cpp
104 VMCore/ValueMapTest.cpp
105 VMCore/VerifierTest.cpp
108 # MSVC9 and 8 cannot compile ValueMapTest.cpp due to their bug.
109 # See issue#331418 in Visual Studio.
110 if(MSVC AND MSVC_VERSION LESS 1600)
111 list(REMOVE_ITEM VMCoreSources VMCore/ValueMapTest.cpp)
114 add_llvm_unittest(VMCore ${VMCoreSources})
116 set(LLVM_LINK_COMPONENTS
121 add_llvm_unittest(Support
122 Support/AllocatorTest.cpp
124 Support/CommandLineTest.cpp
125 Support/ConstantRangeTest.cpp
126 Support/EndianTest.cpp
127 Support/LeakDetectorTest.cpp
128 Support/MathExtrasTest.cpp
130 Support/raw_ostream_test.cpp
131 Support/RegexTest.cpp
132 Support/SwapByteOrderTest.cpp
133 Support/TimeValue.cpp
134 Support/TypeBuilderTest.cpp
135 Support/ValueHandleTest.cpp