Skip to content

Commit f0dcac6

Browse files
committed
Switch Clang to re-use the the newly factored common LLVM
implementation. Yay for '-' lines in CMake! llvm-svn: 158897
1 parent a5d42f8 commit f0dcac6

File tree

1 file changed

+4
-41
lines changed

1 file changed

+4
-41
lines changed

clang/unittests/CMakeLists.txt

Lines changed: 4 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,14 @@
1+
add_custom_target(ClangUnitTests)
2+
set_target_properties(ClangUnitTests PROPERTIES FOLDER "Clang tests")
3+
14
# add_clang_unittest(test_dirname file1.cpp file2.cpp)
25
#
36
# Will compile the list of files together and link against the clang
47
# Produces a binary named 'basename(test_dirname)'.
58
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})
2710
endfunction()
2811

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-
4912
add_clang_unittest(BasicTests
5013
Basic/FileManagerTest.cpp
5114
Basic/SourceManagerTest.cpp

0 commit comments

Comments
 (0)