blob: 1e8cf7b306bb0cf78f896dc0e063988213992a11 [file] [log] [blame]
cmake_minimum_required(VERSION 2.8.12)
set(fuzz_targets lys_parse_mem buf_add_char yang_parse_module)
if(FUZZER STREQUAL "AFL")
foreach(target_name IN LISTS fuzz_targets)
add_executable(${target_name} ${target_name}.c main.c $<TARGET_OBJECTS:yangobj>)
target_link_libraries(${target_name} yang)
target_link_libraries(${target_name} ${CMAKE_THREADS_LIB_INIT})
endforeach(target_name)
elseif(FUZZER STREQUAL "LibFuzzer")
foreach(target_name IN LISTS fuzz_targets)
add_executable(${target_name} ${target_name}.c $<TARGET_OBJECTS:yangobj>)
set_source_files_properties(${target_name}.c PROPERTIES COMPILE_FLAGS "-fsanitize=fuzzer")
target_link_libraries(${target_name} yang "-fsanitize=fuzzer")
endforeach(target_name)
endif()