From: Matt Morehouse Date: Thu, 12 Oct 2017 18:39:10 +0000 (+0000) Subject: [clang-format] Allow building fuzzer with OSS-Fuzz flags. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=780c8ad4b33c3e9703a02584c1afe7e81f38144b;p=clang [clang-format] Allow building fuzzer with OSS-Fuzz flags. Reviewers: kcc, bogner Reviewed By: kcc Subscribers: cfe-commits, mgorny Differential Revision: https://reviews.llvm.org/D38853 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315603 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/tools/clang-format/CMakeLists.txt b/tools/clang-format/CMakeLists.txt index a13633eaef..466cc009b4 100644 --- a/tools/clang-format/CMakeLists.txt +++ b/tools/clang-format/CMakeLists.txt @@ -15,7 +15,7 @@ target_link_libraries(clang-format ${CLANG_FORMAT_LIB_DEPS} ) -if( LLVM_USE_SANITIZE_COVERAGE ) +if( LIB_FUZZING_ENGINE OR LLVM_USE_SANITIZE_COVERAGE ) add_subdirectory(fuzzer) endif() diff --git a/tools/clang-format/fuzzer/CMakeLists.txt b/tools/clang-format/fuzzer/CMakeLists.txt index 9dc4f2a6e8..245186eea1 100644 --- a/tools/clang-format/fuzzer/CMakeLists.txt +++ b/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 @@ add_clang_executable(clang-format-fuzzer ) target_link_libraries(clang-format-fuzzer - ${CLANG_FORMAT_LIB_DEPS}) + ${CLANG_FORMAT_LIB_DEPS} + ${LIB_FUZZING_ENGINE} + )