THRIFT-3097 cmake targets unconditionally depend on optional libraries
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2800167..f19f999 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -75,7 +75,11 @@
if(WITH_CPP)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/lib/cpp)
if(BUILD_TESTING)
- add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/test/cpp)
+ if(WITH_LIBEVENT)
+ add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/test/cpp)
+ else()
+ message(WARNING "libevent not found or disabled; will not build some tests")
+ endif()
endif()
endif()