blob: fd55e31ed568e6b619e80d3f16eb7586f67aa993 [file] [log] [blame]
Philippe Antoine72333522018-05-03 16:40:24 +02001set(libs
Raef Coles995c66f2020-10-13 16:30:41 +01002 ${mbedtls_target}
Philippe Antoine72333522018-05-03 16:40:24 +02003)
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
Philippe Antoine81496272019-06-04 14:47:58 +020013find_library(FUZZINGENGINE_LIB FuzzingEngine)
Ronald Cronbfd45f12020-06-05 11:15:31 +020014if(FUZZINGENGINE_LIB)
Philippe Antoine81496272019-06-04 14:47:58 +020015 project(fuzz CXX)
Philippe Antoine81496272019-06-04 14:47:58 +020016endif()
Ronald Cronbfd45f12020-06-05 11:15:31 +020017
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
David Browna8e309e2020-11-18 15:07:24 -070035 set(exe_sources ${exe}.c $<TARGET_OBJECTS:mbedtls_test>)
36 if(NOT FUZZINGENGINE_LIB)
37 list(APPEND exe_sources onefile.c)
Ronald Cronbfd45f12020-06-05 11:15:31 +020038 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)
David Browna8e309e2020-11-18 15:07:24 -070042 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)
Ronald Cronbfd45f12020-06-05 11:15:31 +020053 endif()
54
55endforeach()