Skip to content

Commit

Permalink
Support building fuzz targets
Browse files Browse the repository at this point in the history
  • Loading branch information
wtdcode committed Oct 6, 2021
1 parent 8ab7e06 commit a4c6298
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1141,6 +1141,7 @@ else()
)
endif()


foreach(SAMPLE_FILE ${UNICORN_SAMPLE_FILE})
add_executable(${SAMPLE_FILE}
${CMAKE_CURRENT_SOURCE_DIR}/samples/${SAMPLE_FILE}.c
Expand All @@ -1160,6 +1161,19 @@ foreach(TEST_FILE ${UNICORN_TEST_FILE})
add_test(${TEST_FILE} ${TEST_FILE})
endforeach(TEST_FILE)

if(UNICORN_FUZZ)
set(UNICORN_FUZZ_SUFFIX "arm_arm;arm_armbe;arm_thumb;arm64_arm;arm64_armbe;m68k_be;mips_32be;mips_32le;sparc_32be;x86_16;x86_32;x86_64")
set(SAMPLES_LIB ${SAMPLES_LIB} rt)
foreach(SUFFIX ${UNICORN_FUZZ_SUFFIX})
add_executable(fuzz_emu_${SUFFIX}
${CMAKE_CURRENT_SOURCE_DIR}/tests/fuzz/fuzz_emu_${SUFFIX}
${CMAKE_CURRENT_SOURCE_DIR}/tests/fuzz/onedir.c
)
target_link_libraries(fuzz_emu_${SUFFIX}
${SAMPLES_LIB}
)
endforeach()
endif()

if(NOT MSVC)
include("GNUInstallDirs")
Expand Down

0 comments on commit a4c6298

Please sign in to comment.