Skip to content
Snippets Groups Projects
Commit ef2fa127 authored by Serge Lamikhov-Center's avatar Serge Lamikhov-Center
Browse files

Add elfio_fuzzer to tests' compilation

parent 9d6984a5
No related branches found
No related tags found
No related merge requests found
include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/9a32aee22d771387c494be2d8519fbdf46a713b2.zip
googletest
URL https://github.com/google/googletest/archive/9a32aee22d771387c494be2d8519fbdf46a713b2.zip
)
# For Windows: Prevent overriding the parent project's compiler/linker settings
......@@ -21,7 +21,7 @@ file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/elf_examples)
# Second, glob all files under elf_examples
file(GLOB elf_examples
LIST_DIRECTORIES
false
false
CONFIGURE_DEPENDS
elf_examples/*)
......@@ -43,16 +43,35 @@ add_executable(
target_link_libraries(
ELFIOTest
PRIVATE
elfio::elfio
gtest_main)
elfio::elfio
gtest_main)
add_test(
NAME
ELFIOTest
ELFIOTest
COMMAND
${CMAKE_CURRENT_BINARY_DIR}/ELFIOTest
${CMAKE_CURRENT_BINARY_DIR}/ELFIOTest
WORKING_DIRECTORY
${CMAKE_CURRENT_BINARY_DIR})
${CMAKE_CURRENT_BINARY_DIR})
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_executable(
elfio_fuzzer
elfio_fuzzer.cpp)
target_link_libraries(
elfio_fuzzer
PRIVATE
elfio::elfio)
target_compile_options(elfio_fuzzer
PRIVATE $<$<C_COMPILER_ID:Clang>:-g -O1 -fsanitize=fuzzer>
)
target_link_libraries(elfio_fuzzer
PRIVATE $<$<C_COMPILER_ID:Clang>:-fsanitize=fuzzer>
)
endif()
add_dependencies(check ELFIOTest)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment