From 4904953de69bf4acbe5736ba804bf3a8feffec3c Mon Sep 17 00:00:00 2001 From: Thomas Dickerson Date: Thu, 12 May 2022 10:09:43 -0400 Subject: [PATCH] Fix missing dependency error when BUILD_TESTING=OFF Without this patch, we get the following error: ```console CMake Error at CMakeLists.txt:77 (add_dependencies): The dependency target "writer_tests" of target "clang-tidy" does not exist. ``` when `BUILD_TESTING=OFF` --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b975d490..0d1f9dee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -74,7 +74,9 @@ if(CLANG_TIDY AND PROTOBUF_FOUND) ${CMAKE_SOURCE_DIR}/test/unit/*.cpp ${CMAKE_SOURCE_DIR}/tools/*.cpp ) - add_dependencies(clang-tidy writer_tests) + if(BUILD_TESTING) + add_dependencies(clang-tidy writer_tests) + endif() else() message(STATUS "Looking for clang-tidy - not found") message(STATUS " Build target 'clang-tidy' will not be available.")