From: Chandler Carruth Date: Thu, 21 Jun 2012 09:51:42 +0000 (+0000) Subject: Clang side of a refactoring of the CMake unit test build strategy. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0c750ec837f7ae06f0a64d3da56d7578d923b3cf;p=clang Clang side of a refactoring of the CMake unit test build strategy. The fundamental change is to put a CMakeLists.txt file in the unittest directory, with a single test binary produced from it. This has several advantages. Among other fundamental advantages, we start to get the checking logic for when a file is missing from the CMake build, and this caught one missing file already! More fun details in the LLVM commit corresponding to this one. Note that the LLVM commit and this one most both be applied, or neither. Sorry for any skew issues. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158910 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/unittests/Basic/CMakeLists.txt b/unittests/Basic/CMakeLists.txt new file mode 100644 index 0000000000..300dcd5cb8 --- /dev/null +++ b/unittests/Basic/CMakeLists.txt @@ -0,0 +1,9 @@ +add_clang_unittest(BasicTests + FileManagerTest.cpp + SourceManagerTest.cpp + ) + +target_link_libraries(BasicTests + clangBasic + clangLex + ) diff --git a/unittests/CMakeLists.txt b/unittests/CMakeLists.txt index cccca6e261..3dd927d9b9 100644 --- a/unittests/CMakeLists.txt +++ b/unittests/CMakeLists.txt @@ -9,37 +9,7 @@ function(add_clang_unittest test_dirname) add_unittest(ClangUnitTests ${test_dirname} ${ARGN}) endfunction() -add_clang_unittest(BasicTests - Basic/FileManagerTest.cpp - Basic/SourceManagerTest.cpp - ) -target_link_libraries(BasicTests - clangLex - ) - -add_clang_unittest(LexTests - Lex/LexerTest.cpp - ) -target_link_libraries(LexTests - clangLex - ) - -add_clang_unittest(FrontendTests - Frontend/FrontendActionTest.cpp - ) -target_link_libraries(FrontendTests - clangFrontend - ) - -add_clang_unittest(ToolingTests - Tooling/CompilationDatabaseTest.cpp - Tooling/ToolingTest.cpp - Tooling/RecursiveASTVisitorTest.cpp - Tooling/RefactoringTest.cpp - Tooling/RewriterTest.cpp - ) -target_link_libraries(ToolingTests - clangAST - clangTooling - clangRewrite - ) +add_subdirectory(Basic) +add_subdirectory(Lex) +add_subdirectory(Frontend) +add_subdirectory(Tooling) diff --git a/unittests/Frontend/CMakeLists.txt b/unittests/Frontend/CMakeLists.txt new file mode 100644 index 0000000000..729c6487b3 --- /dev/null +++ b/unittests/Frontend/CMakeLists.txt @@ -0,0 +1,6 @@ +add_clang_unittest(FrontendTests + FrontendActionTest.cpp + ) +target_link_libraries(FrontendTests + clangFrontend + ) diff --git a/unittests/Lex/CMakeLists.txt b/unittests/Lex/CMakeLists.txt new file mode 100644 index 0000000000..10c936199d --- /dev/null +++ b/unittests/Lex/CMakeLists.txt @@ -0,0 +1,8 @@ +add_clang_unittest(LexTests + LexerTest.cpp + PreprocessingRecordTest.cpp + ) + +target_link_libraries(LexTests + clangLex + ) diff --git a/unittests/Tooling/CMakeLists.txt b/unittests/Tooling/CMakeLists.txt new file mode 100644 index 0000000000..876a9c1bdc --- /dev/null +++ b/unittests/Tooling/CMakeLists.txt @@ -0,0 +1,13 @@ +add_clang_unittest(ToolingTests + CompilationDatabaseTest.cpp + ToolingTest.cpp + RecursiveASTVisitorTest.cpp + RefactoringTest.cpp + RewriterTest.cpp + ) + +target_link_libraries(ToolingTests + clangAST + clangTooling + clangRewrite + )