File: CMakeLists.txt

package info (click to toggle)
fmtlib 10.1.1%2Bds1-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,860 kB
  • sloc: cpp: 19,684; ansic: 2,022; python: 139; sh: 53; makefile: 25
file content (30 lines) | stat: -rw-r--r-- 1,225 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Copyright (c) 2019, Paul Dreik
# License: see LICENSE.rst in the fmt root directory

# Link in the main function. 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")

# Adds a binary for reproducing, i.e. no fuzzing, just enables replaying data
# through the fuzzers.
function(add_fuzzer source)
  get_filename_component(basename ${source} NAME_WE)
  set(name ${basename}-fuzzer)
  add_executable(${name} ${source} fuzzer-common.h)
  if (FMT_FUZZ_LINKMAIN)
    target_sources(${name} PRIVATE main.cc)
  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_std_14)
endfunction()

foreach (source chrono-duration.cc chrono-timepoint.cc float.cc named-arg.cc one-arg.cc two-args.cc)
  add_fuzzer(${source})
endforeach ()