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/IntervalMapTest.cpp
58 ADT/SmallBitVectorTest.cpp
59 ADT/SmallStringTest.cpp
60 ADT/SmallVectorTest.cpp
61 ADT/SparseBitVectorTest.cpp
68 add_llvm_unittest(Analysis
69 Analysis/ScalarEvolutionTest.cpp
72 add_llvm_unittest(ExecutionEngine
73 ExecutionEngine/ExecutionEngineTest.cpp
77 ExecutionEngine/JIT/JITEventListenerTest.cpp
78 ExecutionEngine/JIT/JITMemoryManagerTest.cpp
79 ExecutionEngine/JIT/JITTest.cpp
80 ExecutionEngine/JIT/MultiJITTest.cpp
84 list(APPEND JITTestsSources ExecutionEngine/JIT/JITTests.def)
87 add_llvm_unittest(ExecutionEngine/JIT ${JITTestsSources})
90 set_property(TARGET JITTests PROPERTY LINK_FLAGS -Wl,--export-all-symbols)
93 add_llvm_unittest(Transforms/Utils
94 Transforms/Utils/Cloning.cpp
98 VMCore/ConstantsTest.cpp
99 VMCore/DerivedTypesTest.cpp
100 VMCore/InstructionsTest.cpp
101 VMCore/MetadataTest.cpp
102 VMCore/PassManagerTest.cpp
103 VMCore/ValueMapTest.cpp
104 VMCore/VerifierTest.cpp
107 # MSVC9 and 8 cannot compile ValueMapTest.cpp due to their bug.
108 # See issue#331418 in Visual Studio.
109 if(MSVC AND MSVC_VERSION LESS 1600)
110 list(REMOVE_ITEM VMCoreSources VMCore/ValueMapTest.cpp)
113 add_llvm_unittest(VMCore ${VMCoreSources})
115 set(LLVM_LINK_COMPONENTS
120 add_llvm_unittest(Support
121 Support/AllocatorTest.cpp
123 Support/CommandLineTest.cpp
124 Support/ConstantRangeTest.cpp
125 Support/EndianTest.cpp
126 Support/LeakDetectorTest.cpp
127 Support/MathExtrasTest.cpp
129 Support/raw_ostream_test.cpp
130 Support/RegexTest.cpp
131 Support/SwapByteOrderTest.cpp
132 Support/TimeValue.cpp
133 Support/TypeBuilderTest.cpp
134 Support/ValueHandleTest.cpp