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