]> granicus.if.org Git - clang/commitdiff
Improves CMakeLists.txt for Clang's unit tests: make "linked
authorZhanyong Wan <wan@google.com>
Wed, 16 Feb 2011 05:19:17 +0000 (05:19 +0000)
committerZhanyong Wan <wan@google.com>
Wed, 16 Feb 2011 05:19:17 +0000 (05:19 +0000)
components" and "used libs" arguments of add_clang_unittest().
Reviewed by jyasskin and chapuni.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125652 91177308-0d34-0410-b5e6-96231b3b80d8

unittests/CMakeLists.txt

index c7c773348f1e849201f00cc6b936b5e00bcd039c..b001d15bcb2f162937ba0134ccd7577e226f6388 100644 (file)
@@ -1,4 +1,8 @@
-function(add_clang_unittest test_dirname)
+function(add_clang_unittest test_dirname link_components used_libs)
+  separate_arguments(link_components)
+  set(LLVM_LINK_COMPONENTS ${link_components})
+  separate_arguments(used_libs)
+  set(LLVM_USED_LIBS ${used_libs})
   string(REGEX MATCH "([^/]+)$" test_name ${test_dirname})
   if (CMAKE_BUILD_TYPE)
     set(CMAKE_RUNTIME_OUTPUT_DIRECTORY
@@ -32,16 +36,8 @@ if(SUPPORTS_NO_VARIADIC_MACROS_FLAG)
   add_definitions("-Wno-variadic-macros")
 endif()
 
-set(LLVM_LINK_COMPONENTS
-  Core
-  )
-
-set(LLVM_USED_LIBS
-  gtest
-  gtest_main
-  clangFrontend
-  )
-
 add_clang_unittest(Frontend
+  "Core"
+  "gtest gtest_main clangFrontend"
   Frontend/FrontendActionTest.cpp
  )