]> granicus.if.org Git - clang/commitdiff
Clang side of a refactoring of the CMake unit test build strategy.
authorChandler Carruth <chandlerc@gmail.com>
Thu, 21 Jun 2012 09:51:42 +0000 (09:51 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Thu, 21 Jun 2012 09:51:42 +0000 (09:51 +0000)
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

unittests/Basic/CMakeLists.txt [new file with mode: 0644]
unittests/CMakeLists.txt
unittests/Frontend/CMakeLists.txt [new file with mode: 0644]
unittests/Lex/CMakeLists.txt [new file with mode: 0644]
unittests/Tooling/CMakeLists.txt [new file with mode: 0644]

diff --git a/unittests/Basic/CMakeLists.txt b/unittests/Basic/CMakeLists.txt
new file mode 100644 (file)
index 0000000..300dcd5
--- /dev/null
@@ -0,0 +1,9 @@
+add_clang_unittest(BasicTests
+  FileManagerTest.cpp
+  SourceManagerTest.cpp
+  )
+
+target_link_libraries(BasicTests
+  clangBasic
+  clangLex
+  )
index cccca6e2616c121561b9395943ac027e8f496fc3..3dd927d9b99a4ad9aacd0e0b06caa18a86ec8c43 100644 (file)
@@ -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 (file)
index 0000000..729c648
--- /dev/null
@@ -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 (file)
index 0000000..10c9361
--- /dev/null
@@ -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 (file)
index 0000000..876a9c1
--- /dev/null
@@ -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
+  )