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