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} |
Paul Elliott | 4068c7e | 2023-12-15 17:14:34 +0000 | [diff] [blame] | 3 | ${CMAKE_THREAD_LIBS_INIT} |
Philippe Antoine | 7233352 | 2018-05-03 16:40:24 +0200 | [diff] [blame] | 4 | ) |
| 5 | |
Philippe Antoine | 8149627 | 2019-06-04 14:47:58 +0200 | [diff] [blame] | 6 | find_library(FUZZINGENGINE_LIB FuzzingEngine) |
Ronald Cron | bfd45f1 | 2020-06-05 11:15:31 +0200 | [diff] [blame] | 7 | if(FUZZINGENGINE_LIB) |
Philippe Antoine | 8149627 | 2019-06-04 14:47:58 +0200 | [diff] [blame] | 8 | project(fuzz CXX) |
Philippe Antoine | 8149627 | 2019-06-04 14:47:58 +0200 | [diff] [blame] | 9 | endif() |
Ronald Cron | bfd45f1 | 2020-06-05 11:15:31 +0200 | [diff] [blame] | 10 | |
| 11 | set(executables_no_common_c |
Ronald Cron | bfd45f1 | 2020-06-05 11:15:31 +0200 | [diff] [blame] | 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 | ) |
Gilles Peskine | 5dab92e | 2024-09-14 12:13:16 +0200 | [diff] [blame] | 17 | add_dependencies(${programs_target} ${executables_no_common_c}) |
Ronald Cron | bfd45f1 | 2020-06-05 11:15:31 +0200 | [diff] [blame] | 18 | |
| 19 | set(executables_with_common_c |
| 20 | fuzz_client |
| 21 | fuzz_dtlsclient |
| 22 | fuzz_dtlsserver |
| 23 | fuzz_server |
| 24 | ) |
Gilles Peskine | 5dab92e | 2024-09-14 12:13:16 +0200 | [diff] [blame] | 25 | add_dependencies(${programs_target} ${executables_with_common_c}) |
Ronald Cron | bfd45f1 | 2020-06-05 11:15:31 +0200 | [diff] [blame] | 26 | |
| 27 | foreach(exe IN LISTS executables_no_common_c executables_with_common_c) |
| 28 | |
Ronald Cron | d5331ff | 2024-11-22 19:09:27 +0100 | [diff] [blame] | 29 | set(exe_sources |
| 30 | ${exe}.c |
| 31 | $<TARGET_OBJECTS:mbedtls_test_helpers> |
Ronald Cron | 5096b4c | 2024-12-06 10:09:33 +0100 | [diff] [blame] | 32 | $<TARGET_OBJECTS:mbedtls_test>) |
David Brown | a8e309e | 2020-11-18 15:07:24 -0700 | [diff] [blame] | 33 | if(NOT FUZZINGENGINE_LIB) |
Ben Taylor | 80490a2 | 2025-06-04 08:24:01 +0100 | [diff] [blame] | 34 | list(APPEND exe_sources onefile.c) |
Ronald Cron | bfd45f1 | 2020-06-05 11:15:31 +0200 | [diff] [blame] | 35 | endif() |
| 36 | |
| 37 | # This emulates "if ( ... IN_LIST ... )" which becomes available in CMake 3.3 |
| 38 | list(FIND executables_with_common_c ${exe} exe_index) |
David Brown | a8e309e | 2020-11-18 15:07:24 -0700 | [diff] [blame] | 39 | if(${exe_index} GREATER -1) |
Ben Taylor | d6cc47e | 2025-06-04 09:24:43 +0100 | [diff] [blame^] | 40 | list(APPEND exe_sources common.c) |
David Brown | a8e309e | 2020-11-18 15:07:24 -0700 | [diff] [blame] | 41 | endif() |
| 42 | |
| 43 | add_executable(${exe} ${exe_sources}) |
Ronald Cron | b247898 | 2024-10-07 16:17:07 +0200 | [diff] [blame] | 44 | set_base_compile_options(${exe}) |
David Horstmann | d2cabf2 | 2024-11-04 13:52:37 +0000 | [diff] [blame] | 45 | target_include_directories(${exe} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../framework/tests/include |
| 46 | ${CMAKE_CURRENT_SOURCE_DIR}/../../tests/include) |
David Brown | a8e309e | 2020-11-18 15:07:24 -0700 | [diff] [blame] | 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 Cron | bfd45f1 | 2020-06-05 11:15:31 +0200 | [diff] [blame] | 53 | endif() |
| 54 | |
| 55 | endforeach() |