Index: llvm/cmake/modules/AddLLVM.cmake =================================================================== --- llvm/cmake/modules/AddLLVM.cmake +++ llvm/cmake/modules/AddLLVM.cmake @@ -894,7 +894,12 @@ macro(add_llvm_fuzzer name) cmake_parse_arguments(ARG "" "DUMMY_MAIN" "" ${ARGN}) - if( LLVM_USE_SANITIZE_COVERAGE ) + if( LIB_FUZZING_ENGINE ) + set(LLVM_OPTIONAL_SOURCES ${ARG_DUMMY_MAIN}) + add_llvm_executable(${name} ${ARG_UNPARSED_ARGUMENTS}) + target_link_libraries(${name} ${LIB_FUZZING_ENGINE}) + set_target_properties(${name} PROPERTIES FOLDER "Fuzzers") + elseif( LLVM_USE_SANITIZE_COVERAGE ) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer") set(LLVM_OPTIONAL_SOURCES ${ARG_DUMMY_MAIN}) add_llvm_executable(${name} ${ARG_UNPARSED_ARGUMENTS}) @@ -902,7 +907,7 @@ elseif( ARG_DUMMY_MAIN ) add_llvm_executable(${name} ${ARG_DUMMY_MAIN} ${ARG_UNPARSED_ARGUMENTS}) set_target_properties(${name} PROPERTIES FOLDER "Fuzzers") -endif() + endif() endmacro() macro(add_llvm_target target_name)