blob: 1e8cf7b306bb0cf78f896dc0e063988213992a11 [file] [log] [blame]
Juraj Vijtiukf3939c92019-05-14 13:07:38 +02001cmake_minimum_required(VERSION 2.8.12)
2
Juraj Vijtiuk260407e2020-03-18 10:32:13 +01003set(fuzz_targets lys_parse_mem buf_add_char yang_parse_module)
Juraj Vijtiukf3939c92019-05-14 13:07:38 +02004
Juraj Vijtiuk260407e2020-03-18 10:32:13 +01005if(FUZZER STREQUAL "AFL")
6 foreach(target_name IN LISTS fuzz_targets)
7 add_executable(${target_name} ${target_name}.c main.c $<TARGET_OBJECTS:yangobj>)
8 target_link_libraries(${target_name} yang)
9 target_link_libraries(${target_name} ${CMAKE_THREADS_LIB_INIT})
10 endforeach(target_name)
11elseif(FUZZER STREQUAL "LibFuzzer")
12 foreach(target_name IN LISTS fuzz_targets)
13 add_executable(${target_name} ${target_name}.c $<TARGET_OBJECTS:yangobj>)
14 set_source_files_properties(${target_name}.c PROPERTIES COMPILE_FLAGS "-fsanitize=fuzzer")
15 target_link_libraries(${target_name} yang "-fsanitize=fuzzer")
16 endforeach(target_name)
17endif()