[ASan] simplify cmake rules for adding lit testsuites

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@161412 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/asan/lit_tests/CMakeLists.txt b/lib/asan/lit_tests/CMakeLists.txt
index 2666a9a..c754074 100644
--- a/lib/asan/lit_tests/CMakeLists.txt
+++ b/lib/asan/lit_tests/CMakeLists.txt
@@ -11,19 +11,16 @@
   ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
   )
 
-set(ASAN_TEST_DEPS
-  clang-rt.asan-x86_64 clang-rt.asan-i386
-  )
-if(LLVM_INCLUDE_TESTS)
-  list(APPEND ASAN_TEST_DEPS AsanUnitTests)
-endif()
-
 if("${CMAKE_HOST_SYSTEM}" STREQUAL "${CMAKE_SYSTEM}")
   # Run ASan output tests only if we're not cross-compiling,
   # and can be sure that clang would produce working binaries.
-  list(APPEND ASAN_TEST_DEPS
+  set(ASAN_TEST_DEPS
     clang clang-headers FileCheck count not
+    clang-rt.asan-x86_64 clang-rt.asan-i386
     )
+  if(LLVM_INCLUDE_TESTS)
+    list(APPEND ASAN_TEST_DEPS AsanUnitTests)
+  endif()
   add_lit_testsuite(check-asan "Running the AddressSanitizer tests"
     ${CMAKE_CURRENT_BINARY_DIR}
     DEPENDS ${ASAN_TEST_DEPS}
@@ -33,7 +30,7 @@
   # Otherwise run only ASan unit tests.
   add_lit_testsuite(check-asan "Running the AddressSanitizer unit tests"
     ${CMAKE_CURRENT_BINARY_DIR}/Unit
-    DEPENDS ${ASAN_TEST_DEPS}
+    DEPENDS AsanUnitTests
     )
   set_target_properties(check-asan PROPERTIES FOLDER "ASan unit tests")
 endif()