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 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(ExecutionEngine/JIT ${JITTestsSources})
86 set_property(TARGET JITTests PROPERTY LINK_FLAGS -Wl,--export-all-symbols)
89 add_llvm_unittest(Transforms/Utils
90 Transforms/Utils/Cloning.cpp
94 VMCore/ConstantsTest.cpp
95 VMCore/DerivedTypesTest.cpp
96 VMCore/InstructionsTest.cpp
97 VMCore/MetadataTest.cpp
98 VMCore/PassManagerTest.cpp
99 VMCore/ValueMapTest.cpp
100 VMCore/VerifierTest.cpp
103 # MSVC9 and 8 cannot compile ValueMapTest.cpp due to their bug.
104 # See issue#331418 in Visual Studio.
105 if(MSVC AND MSVC_VERSION LESS 1600)
106 list(REMOVE_ITEM VMCoreSources VMCore/ValueMapTest.cpp)
109 add_llvm_unittest(VMCore ${VMCoreSources})
111 set(LLVM_LINK_COMPONENTS
116 add_llvm_unittest(Support
117 Support/AllocatorTest.cpp
119 Support/CommandLineTest.cpp
120 Support/ConstantRangeTest.cpp
121 Support/EndianTest.cpp
122 Support/LeakDetectorTest.cpp
123 Support/MathExtrasTest.cpp
125 Support/raw_ostream_test.cpp
126 Support/RegexTest.cpp
127 Support/SwapByteOrderTest.cpp
128 Support/TimeValue.cpp
129 Support/TypeBuilderTest.cpp
130 Support/ValueHandleTest.cpp