Philippe Antoine | 7233352 | 2018-05-03 16:40:24 +0200 | [diff] [blame] | 1 | set(libs |
Raef Coles | 995c66f | 2020-10-13 16:30:41 +0100 | [diff] [blame] | 2 | ${mbedtls_target} |
Philippe Antoine | 7233352 | 2018-05-03 16:40:24 +0200 | [diff] [blame] | 3 | ) |
| 4 | |
| 5 | if(USE_PKCS11_HELPER_LIBRARY) |
| 6 | set(libs ${libs} pkcs11-helper) |
| 7 | endif(USE_PKCS11_HELPER_LIBRARY) |
| 8 | |
| 9 | if(ENABLE_ZLIB_SUPPORT) |
| 10 | set(libs ${libs} ${ZLIB_LIBRARIES}) |
| 11 | endif(ENABLE_ZLIB_SUPPORT) |
| 12 | |
Philippe Antoine | 8149627 | 2019-06-04 14:47:58 +0200 | [diff] [blame] | 13 | find_library(FUZZINGENGINE_LIB FuzzingEngine) |
Ronald Cron | bfd45f1 | 2020-06-05 11:15:31 +0200 | [diff] [blame] | 14 | if(FUZZINGENGINE_LIB) |
Philippe Antoine | 8149627 | 2019-06-04 14:47:58 +0200 | [diff] [blame] | 15 | project(fuzz CXX) |
Philippe Antoine | 8149627 | 2019-06-04 14:47:58 +0200 | [diff] [blame] | 16 | endif() |
Ronald Cron | bfd45f1 | 2020-06-05 11:15:31 +0200 | [diff] [blame] | 17 | |
| 18 | set(executables_no_common_c |
| 19 | fuzz_privkey |
| 20 | fuzz_pubkey |
| 21 | fuzz_x509crl |
| 22 | fuzz_x509crt |
| 23 | fuzz_x509csr |
| 24 | ) |
| 25 | |
| 26 | set(executables_with_common_c |
| 27 | fuzz_client |
| 28 | fuzz_dtlsclient |
| 29 | fuzz_dtlsserver |
| 30 | fuzz_server |
| 31 | ) |
| 32 | |
| 33 | foreach(exe IN LISTS executables_no_common_c executables_with_common_c) |
| 34 | |
David Brown | a8e309e | 2020-11-18 15:07:24 -0700 | [diff] [blame] | 35 | set(exe_sources ${exe}.c $<TARGET_OBJECTS:mbedtls_test>) |
| 36 | if(NOT FUZZINGENGINE_LIB) |
| 37 | list(APPEND exe_sources onefile.c) |
Ronald Cron | bfd45f1 | 2020-06-05 11:15:31 +0200 | [diff] [blame] | 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) |
David Brown | a8e309e | 2020-11-18 15:07:24 -0700 | [diff] [blame] | 42 | if(${exe_index} GREATER -1) |
| 43 | list(APPEND exe_sources common.c) |
| 44 | endif() |
| 45 | |
| 46 | add_executable(${exe} ${exe_sources}) |
Mateusz Starzyk | 1aec646 | 2021-02-08 15:34:42 +0100 | [diff] [blame^] | 47 | target_include_directories(${exe} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../tests/include) |
David Brown | a8e309e | 2020-11-18 15:07:24 -0700 | [diff] [blame] | 48 | |
| 49 | if (NOT FUZZINGENGINE_LIB) |
| 50 | target_link_libraries(${exe} ${libs}) |
| 51 | else() |
| 52 | target_link_libraries(${exe} ${libs} FuzzingEngine) |
| 53 | SET_TARGET_PROPERTIES(${exe} PROPERTIES LINKER_LANGUAGE CXX) |
Ronald Cron | bfd45f1 | 2020-06-05 11:15:31 +0200 | [diff] [blame] | 54 | endif() |
| 55 | |
| 56 | endforeach() |