diff options
author | Manuel Bentele | 2020-10-20 15:31:52 +0200 |
---|---|---|
committer | Manuel Bentele | 2020-10-20 15:31:52 +0200 |
commit | 85c3fe47292f4e4e47a1f58f1347cb1f6d03b37e (patch) | |
tree | d8d7cf3d229bec1ec0b94747b5f427fd6bd6f063 /cmake | |
parent | [BUILD] do not stop Release build if repository is dirty but warn (diff) | |
download | dnbd3-85c3fe47292f4e4e47a1f58f1347cb1f6d03b37e.tar.gz dnbd3-85c3fe47292f4e4e47a1f58f1347cb1f6d03b37e.tar.xz dnbd3-85c3fe47292f4e4e47a1f58f1347cb1f6d03b37e.zip |
[BUILD] add option to build the dnbd3-server with afl-fuzz support
The afl-fuzz support for the dnbd3-server requires an AFL C compiler
like afl-gcc and can be enabled with the CMake option DNBD3_SERVER_AFL.
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/CheckAFLCCompiler.cmake | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/cmake/CheckAFLCCompiler.cmake b/cmake/CheckAFLCCompiler.cmake new file mode 100644 index 0000000..249248b --- /dev/null +++ b/cmake/CheckAFLCCompiler.cmake @@ -0,0 +1,24 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Copyright (C) 2020 Manuel Bentele <development@manuel-bentele.de> +# + +# check if corresponding AFL C Compiler form original C compiler is available +# if an AFL C compiler is available, then the path to the AFL C compiler is returned in AFL_C_COMPILER +macro(check_afl_c_compiler AFL_C_COMPILER AFL_C_COMPILER_NAME C_COMPILER_PATH C_COMPILER_ID) + # determine AFL C compiler suffix from original C compiler ID + if(${C_COMPILER_ID} MATCHES "GNU") + set(AFL_C_COMPILER_SUFFIX "gcc") + elseif(${C_COMPILER_ID} MATCHES "Clang") + set(AFL_C_COMPILER_SUFFIX "clang") + else(${C_COMPILER_ID} MATCHES "Clang") + get_filename_component(AFL_C_COMPILER_SUFFIX ${C_COMPILER_PATH} NAME) + endif(${C_COMPILER_ID} MATCHES "GNU") + + # define search file name and search for AFL C compiler program + set(AFL_C_COMPILER_SEARCH_NAME "afl-${AFL_C_COMPILER_SUFFIX}") + find_program(${AFL_C_COMPILER} NAMES ${AFL_C_COMPILER_SEARCH_NAME}) + + # return the AFL C compiler name to the caller + set(${AFL_C_COMPILER_NAME} ${AFL_C_COMPILER_SEARCH_NAME}) +endmacro(check_afl_c_compiler)
\ No newline at end of file |