| 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 | |
| Philippe Antoine | 8149627 | 2019-06-04 14:47:58 +0200 | [diff] [blame] | 9 | find_library(FUZZINGENGINE_LIB FuzzingEngine) |
| Ronald Cron | bfd45f1 | 2020-06-05 11:15:31 +0200 | [diff] [blame] | 10 | if(FUZZINGENGINE_LIB) |
| Philippe Antoine | 8149627 | 2019-06-04 14:47:58 +0200 | [diff] [blame] | 11 | project(fuzz CXX) |
| Philippe Antoine | 8149627 | 2019-06-04 14:47:58 +0200 | [diff] [blame] | 12 | endif() |
| Ronald Cron | bfd45f1 | 2020-06-05 11:15:31 +0200 | [diff] [blame] | 13 | |
| 14 | set(executables_no_common_c |
| 15 | fuzz_privkey |
| 16 | fuzz_pubkey |
| 17 | fuzz_x509crl |
| 18 | fuzz_x509crt |
| 19 | fuzz_x509csr |
| 20 | ) |
| 21 | |
| 22 | set(executables_with_common_c |
| 23 | fuzz_client |
| 24 | fuzz_dtlsclient |
| 25 | fuzz_dtlsserver |
| 26 | fuzz_server |
| 27 | ) |
| 28 | |
| 29 | foreach(exe IN LISTS executables_no_common_c executables_with_common_c) |
| 30 | |
| David Brown | a8e309e | 2020-11-18 15:07:24 -0700 | [diff] [blame] | 31 | set(exe_sources ${exe}.c $<TARGET_OBJECTS:mbedtls_test>) |
| 32 | if(NOT FUZZINGENGINE_LIB) |
| 33 | list(APPEND exe_sources onefile.c) |
| Ronald Cron | bfd45f1 | 2020-06-05 11:15:31 +0200 | [diff] [blame] | 34 | endif() |
| 35 | |
| 36 | # This emulates "if ( ... IN_LIST ... )" which becomes available in CMake 3.3 |
| 37 | list(FIND executables_with_common_c ${exe} exe_index) |
| David Brown | a8e309e | 2020-11-18 15:07:24 -0700 | [diff] [blame] | 38 | if(${exe_index} GREATER -1) |
| 39 | list(APPEND exe_sources common.c) |
| 40 | endif() |
| 41 | |
| 42 | add_executable(${exe} ${exe_sources}) |
| Mateusz Starzyk | 1aec646 | 2021-02-08 15:34:42 +0100 | [diff] [blame] | 43 | target_include_directories(${exe} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../tests/include) |
| David Brown | a8e309e | 2020-11-18 15:07:24 -0700 | [diff] [blame] | 44 | |
| 45 | if (NOT FUZZINGENGINE_LIB) |
| 46 | target_link_libraries(${exe} ${libs}) |
| 47 | else() |
| 48 | target_link_libraries(${exe} ${libs} FuzzingEngine) |
| 49 | SET_TARGET_PROPERTIES(${exe} PROPERTIES LINKER_LANGUAGE CXX) |
| Ronald Cron | bfd45f1 | 2020-06-05 11:15:31 +0200 | [diff] [blame] | 50 | endif() |
| 51 | |
| 52 | endforeach() |