• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1set(libs
2    ${mbedtls_target}
3)
4
5if(USE_PKCS11_HELPER_LIBRARY)
6    set(libs ${libs} pkcs11-helper)
7endif(USE_PKCS11_HELPER_LIBRARY)
8
9if(ENABLE_ZLIB_SUPPORT)
10    set(libs ${libs} ${ZLIB_LIBRARIES})
11endif(ENABLE_ZLIB_SUPPORT)
12
13find_library(FUZZINGENGINE_LIB FuzzingEngine)
14if(FUZZINGENGINE_LIB)
15    project(fuzz CXX)
16endif()
17
18set(executables_no_common_c
19    fuzz_privkey
20    fuzz_pubkey
21    fuzz_x509crl
22    fuzz_x509crt
23    fuzz_x509csr
24)
25
26set(executables_with_common_c
27    fuzz_client
28    fuzz_dtlsclient
29    fuzz_dtlsserver
30    fuzz_server
31)
32
33foreach(exe IN LISTS executables_no_common_c executables_with_common_c)
34
35    set(exe_sources ${exe}.c $<TARGET_OBJECTS:mbedtls_test>)
36    if(NOT FUZZINGENGINE_LIB)
37        list(APPEND exe_sources onefile.c)
38    endif()
39
40    # This emulates "if ( ... IN_LIST ... )" which becomes available in CMake 3.3
41    list(FIND executables_with_common_c ${exe} exe_index)
42    if(${exe_index} GREATER -1)
43        list(APPEND exe_sources common.c)
44    endif()
45
46    add_executable(${exe} ${exe_sources})
47
48    if (NOT FUZZINGENGINE_LIB)
49        target_link_libraries(${exe} ${libs})
50    else()
51        target_link_libraries(${exe} ${libs} FuzzingEngine)
52        SET_TARGET_PROPERTIES(${exe} PROPERTIES LINKER_LANGUAGE CXX)
53    endif()
54
55endforeach()
56