|
| 1 | +add_custom_target(ClangUnitTests) |
| 2 | +set_target_properties(ClangUnitTests PROPERTIES FOLDER "Clang tests") |
| 3 | + |
1 | 4 | # add_clang_unittest(test_dirname file1.cpp file2.cpp)
|
2 | 5 | #
|
3 | 6 | # Will compile the list of files together and link against the clang
|
4 | 7 | # Produces a binary named 'basename(test_dirname)'.
|
5 | 8 | function(add_clang_unittest test_dirname)
|
6 |
| - string(REGEX MATCH "([^/]+)$" test_name ${test_dirname}) |
7 |
| - if (CMAKE_BUILD_TYPE) |
8 |
| - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY |
9 |
| - ${CLANG_BINARY_DIR}/unittests/${test_dirname}/${CMAKE_BUILD_TYPE}) |
10 |
| - else() |
11 |
| - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY |
12 |
| - ${CLANG_BINARY_DIR}/unittests/${test_dirname}) |
13 |
| - endif() |
14 |
| - if( NOT LLVM_BUILD_TESTS ) |
15 |
| - set(EXCLUDE_FROM_ALL ON) |
16 |
| - endif() |
17 |
| - |
18 |
| - add_clang_executable(${test_name} ${ARGN}) |
19 |
| - target_link_libraries(${test_name} |
20 |
| - gtest |
21 |
| - gtest_main |
22 |
| - LLVMSupport # gtest needs it for raw_ostream. |
23 |
| - ) |
24 |
| - |
25 |
| - add_dependencies(ClangUnitTests ${test_name}) |
26 |
| - set_target_properties(${test_name} PROPERTIES FOLDER "Clang tests") |
| 9 | + add_unittest(ClangUnitTests ${test_dirname} ${ARGN}) |
27 | 10 | endfunction()
|
28 | 11 |
|
29 |
| -add_custom_target(ClangUnitTests) |
30 |
| -set_target_properties(ClangUnitTests PROPERTIES FOLDER "Clang tests") |
31 |
| - |
32 |
| -include_directories(${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest/include) |
33 |
| - |
34 |
| -add_definitions(-DGTEST_HAS_RTTI=0) |
35 |
| -if( LLVM_COMPILER_IS_GCC_COMPATIBLE ) |
36 |
| - llvm_replace_compiler_option(CMAKE_CXX_FLAGS "-frtti" "-fno-rtti") |
37 |
| -elseif( MSVC ) |
38 |
| - llvm_replace_compiler_option(CMAKE_CXX_FLAGS "/GR" "/GR-") |
39 |
| -endif() |
40 |
| - |
41 |
| -if (NOT LLVM_ENABLE_THREADS) |
42 |
| - add_definitions(-DGTEST_HAS_PTHREAD=0) |
43 |
| -endif() |
44 |
| - |
45 |
| -if(SUPPORTS_NO_VARIADIC_MACROS_FLAG) |
46 |
| - add_definitions("-Wno-variadic-macros") |
47 |
| -endif() |
48 |
| - |
49 | 12 | add_clang_unittest(BasicTests
|
50 | 13 | Basic/FileManagerTest.cpp
|
51 | 14 | Basic/SourceManagerTest.cpp
|
|
0 commit comments