Index: clang/tools/clang-format/CMakeLists.txt =================================================================== --- clang/tools/clang-format/CMakeLists.txt +++ clang/tools/clang-format/CMakeLists.txt @@ -15,7 +15,7 @@ ${CLANG_FORMAT_LIB_DEPS} ) -if( LLVM_USE_SANITIZE_COVERAGE ) +if( LIB_FUZZING_ENGINE OR LLVM_USE_SANITIZE_COVERAGE ) add_subdirectory(fuzzer) endif() Index: clang/tools/clang-format/fuzzer/CMakeLists.txt =================================================================== --- clang/tools/clang-format/fuzzer/CMakeLists.txt +++ clang/tools/clang-format/fuzzer/CMakeLists.txt @@ -1,6 +1,8 @@ set(LLVM_LINK_COMPONENTS support) -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer") +if(LLVM_USE_SANITIZE_COVERAGE) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer") +endif() add_clang_executable(clang-format-fuzzer EXCLUDE_FROM_ALL @@ -8,4 +10,6 @@ ) target_link_libraries(clang-format-fuzzer - ${CLANG_FORMAT_LIB_DEPS}) + ${CLANG_FORMAT_LIB_DEPS} + ${LIB_FUZZING_ENGINE} + )