diff --git a/CMakeLists.txt b/CMakeLists.txt
index f8285b8..bf184d1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -296,12 +296,12 @@ if(LEVELDB_BUILD_TESTS)
   set(build_gmock ON)
 
   # This project is tested using GoogleTest.
-  add_subdirectory("third_party/googletest")
+  add_subdirectory("third_party/googletest" EXCLUDE_FROM_ALL)
 
   # This project uses Google benchmark for benchmarking.
   set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "" FORCE)
   set(BENCHMARK_ENABLE_EXCEPTIONS OFF CACHE BOOL "" FORCE)
-  add_subdirectory("third_party/benchmark")
+  add_subdirectory("third_party/benchmark" EXCLUDE_FROM_ALL)
 
   # GoogleTest triggers a missing field initializers warning.
   if(LEVELDB_HAVE_NO_MISSING_FIELD_INITIALIZERS)
