Juraj Vijtiuk | f3939c9 | 2019-05-14 13:07:38 +0200 | [diff] [blame] | 1 | cmake_minimum_required(VERSION 2.8.12) |
| 2 | |
Juraj Vijtiuk | c496e6f | 2020-06-30 16:15:01 +0200 | [diff] [blame] | 3 | set(fuzz_targets lys_parse_mem lyd_parse_mem buf_add_char yang_parse_module) |
Juraj Vijtiuk | f3939c9 | 2019-05-14 13:07:38 +0200 | [diff] [blame] | 4 | |
Juraj Vijtiuk | 260407e | 2020-03-18 10:32:13 +0100 | [diff] [blame] | 5 | if(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) |
| 11 | elseif(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) |
| 17 | endif() |