[CMake] Don't add gtest if it is already there
authorChris Bieneman <beanz@apple.com>
Mon, 5 Dec 2016 19:40:34 +0000 (19:40 +0000)
committerChris Bieneman <beanz@apple.com>
Mon, 5 Dec 2016 19:40:34 +0000 (19:40 +0000)
LLVM build trees export the gtest library through a special export set. If you're building against a build tree you shouldn't need to re-add gtest, but if you're building against an installed LLVM you do.

llvm-svn: 288691

lldb/unittests/CMakeLists.txt

index cd5988d..a865dbe 100644 (file)
@@ -15,7 +15,7 @@ include(${LLDB_PROJECT_ROOT}/cmake/LLDBDependencies.cmake)
 if (LLDB_BUILT_STANDALONE)
   # Build the gtest library needed for unittests, if we have LLVM sources
   # handy.
-  if (EXISTS ${LLVM_MAIN_SRC_DIR}/utils/unittest)
+  if (EXISTS ${LLVM_MAIN_SRC_DIR}/utils/unittest AND NOT TARGET gtest)
     add_subdirectory(${LLVM_MAIN_SRC_DIR}/utils/unittest utils/unittest)
   endif()
 endif()