diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
commit | 19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch) | |
tree | 42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/fmt/test/fuzzing/CMakeLists.txt | |
parent | Initial commit. (diff) | |
download | ceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.tar.xz ceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.zip |
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/fmt/test/fuzzing/CMakeLists.txt')
-rw-r--r-- | src/fmt/test/fuzzing/CMakeLists.txt | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/fmt/test/fuzzing/CMakeLists.txt b/src/fmt/test/fuzzing/CMakeLists.txt new file mode 100644 index 000000000..31344fc5c --- /dev/null +++ b/src/fmt/test/fuzzing/CMakeLists.txt @@ -0,0 +1,38 @@ +# Copyright (c) 2019, Paul Dreik +# License: see LICENSE.rst in the fmt root directory + +# settings this links in a main. useful for reproducing, +# kcov, gdb, afl, valgrind. +# (note that libFuzzer can also reproduce, just pass it the files) +option(FMT_FUZZ_LINKMAIN "enables the reproduce mode, instead of libFuzzer" On) + +# For oss-fuzz - insert $LIB_FUZZING_ENGINE into the link flags, but only for +# the fuzz targets, otherwise the cmake configuration step fails. +set(FMT_FUZZ_LDFLAGS "" CACHE STRING "LDFLAGS for the fuzz targets") + +# Find all fuzzers. +set(SOURCES + chrono_duration.cpp + named_arg.cpp + one_arg.cpp + sprintf.cpp + two_args.cpp +) + +macro(implement_fuzzer sourcefile) + get_filename_component(basename ${sourcefile} NAME_WE) + set(name fuzzer_${basename}) + add_executable(${name} ${sourcefile} fuzzer_common.h) + if (FMT_FUZZ_LINKMAIN) + target_sources(${name} PRIVATE main.cpp) + endif () + target_link_libraries(${name} PRIVATE fmt) +if (FMT_FUZZ_LDFLAGS) + target_link_libraries(${name} PRIVATE ${FMT_FUZZ_LDFLAGS}) +endif () + target_compile_features(${name} PRIVATE cxx_generic_lambdas) +endmacro () + +foreach (X IN ITEMS ${SOURCES}) + implement_fuzzer(${X}) +endforeach () |