Paul Bakker | f9c4953 | 2013-12-19 15:40:58 +0100 | [diff] [blame] | 1 | find_package(Threads) |
| 2 | |
Paul Bakker | b06819b | 2011-01-18 16:18:38 +0000 | [diff] [blame] | 3 | set(libs |
Raef Coles | 995c66f | 2020-10-13 16:30:41 +0100 | [diff] [blame] | 4 | ${mbedtls_target} |
Paul Bakker | b06819b | 2011-01-18 16:18:38 +0000 | [diff] [blame] | 5 | ) |
| 6 | |
Ronald Cron | bfd45f1 | 2020-06-05 11:15:31 +0200 | [diff] [blame] | 7 | set(executables |
Manuel Pégourié-Gonnard | 216a183 | 2015-06-25 09:20:03 +0200 | [diff] [blame] | 8 | dtls_client |
| 9 | dtls_server |
Manuel Pégourié-Gonnard | 6f83025 | 2020-04-03 11:56:06 +0200 | [diff] [blame] | 10 | mini_client |
Manuel Pégourié-Gonnard | 216a183 | 2015-06-25 09:20:03 +0200 | [diff] [blame] | 11 | ssl_client1 |
| 12 | ssl_client2 |
Ronald Cron | 2773113 | 2020-06-05 11:51:28 +0200 | [diff] [blame] | 13 | ssl_context_info |
Manuel Pégourié-Gonnard | 216a183 | 2015-06-25 09:20:03 +0200 | [diff] [blame] | 14 | ssl_fork_server |
| 15 | ssl_mail_client |
Manuel Pégourié-Gonnard | 6f83025 | 2020-04-03 11:56:06 +0200 | [diff] [blame] | 16 | ssl_server |
Ronald Cron | 2773113 | 2020-06-05 11:51:28 +0200 | [diff] [blame] | 17 | ssl_server2 |
Paul Bakker | f9c4953 | 2013-12-19 15:40:58 +0100 | [diff] [blame] | 18 | ) |
Gilles Peskine | bb47c73 | 2024-09-14 12:13:16 +0200 | [diff] [blame] | 19 | add_dependencies(${programs_target} ${executables}) |
Gilles Peskine | 7215b1e | 2024-09-14 12:18:00 +0200 | [diff] [blame] | 20 | add_dependencies(${ssl_opt_target} ${executables}) |
Paul Bakker | f9c4953 | 2013-12-19 15:40:58 +0100 | [diff] [blame] | 21 | |
David Horstmann | a8d1406 | 2021-10-20 17:14:23 +0100 | [diff] [blame] | 22 | if(GEN_FILES) |
David Horstmann | d64f4b2 | 2021-10-20 12:29:47 +0100 | [diff] [blame] | 23 | # Inform CMake that the following file will be generated as part of the build |
Manuel Pégourié-Gonnard | e90e405 | 2021-09-08 13:27:09 +0200 | [diff] [blame] | 24 | # process, so it doesn't complain that it doesn't exist yet. Starting from |
| 25 | # CMake 3.20, this will no longer be necessary as CMake will automatically |
David Horstmann | d64f4b2 | 2021-10-20 12:29:47 +0100 | [diff] [blame] | 26 | # propagate this information across the tree, for now it's only visible |
Manuel Pégourié-Gonnard | e90e405 | 2021-09-08 13:27:09 +0200 | [diff] [blame] | 27 | # inside the same directory, so we need to propagate manually. |
| 28 | set_source_files_properties( |
| 29 | ${CMAKE_CURRENT_BINARY_DIR}/../test/query_config.c |
| 30 | PROPERTIES GENERATED TRUE) |
| 31 | endif() |
Manuel Pégourié-Gonnard | 86cfa6c | 2021-05-14 10:07:33 +0200 | [diff] [blame] | 32 | |
Ronald Cron | bfd45f1 | 2020-06-05 11:15:31 +0200 | [diff] [blame] | 33 | foreach(exe IN LISTS executables) |
David Brown | a8e309e | 2020-11-18 15:07:24 -0700 | [diff] [blame] | 34 | set(extra_sources "") |
| 35 | if(exe STREQUAL "ssl_client2" OR exe STREQUAL "ssl_server2") |
| 36 | list(APPEND extra_sources |
Manuel Pégourié-Gonnard | aedca0c | 2021-05-11 13:45:54 +0200 | [diff] [blame] | 37 | ssl_test_lib.c |
Harry Ramsey | 061e0f5 | 2025-02-17 11:59:45 +0000 | [diff] [blame] | 38 | ${MBEDTLS_FRAMEWORK_DIR}/tests/programs/query_config.h |
Manuel Pégourié-Gonnard | 86cfa6c | 2021-05-14 10:07:33 +0200 | [diff] [blame] | 39 | ${CMAKE_CURRENT_BINARY_DIR}/../test/query_config.c) |
David Brown | a8e309e | 2020-11-18 15:07:24 -0700 | [diff] [blame] | 40 | endif() |
| 41 | add_executable(${exe} ${exe}.c $<TARGET_OBJECTS:mbedtls_test> |
| 42 | ${extra_sources}) |
Paul Elliott | 4068c7e | 2023-12-15 17:14:34 +0000 | [diff] [blame] | 43 | target_link_libraries(${exe} ${libs} ${CMAKE_THREAD_LIBS_INIT}) |
Harry Ramsey | 061e0f5 | 2025-02-17 11:59:45 +0000 | [diff] [blame] | 44 | target_include_directories(${exe} PRIVATE ${MBEDTLS_FRAMEWORK_DIR}/tests/programs |
| 45 | ${MBEDTLS_FRAMEWORK_DIR}/tests/include |
David Horstmann | 1d9b033 | 2024-11-04 14:18:27 +0000 | [diff] [blame] | 46 | ${CMAKE_CURRENT_SOURCE_DIR}/../../tests/include) |
Manuel Pégourié-Gonnard | 86cfa6c | 2021-05-14 10:07:33 +0200 | [diff] [blame] | 47 | if(exe STREQUAL "ssl_client2" OR exe STREQUAL "ssl_server2") |
David Horstmann | a8d1406 | 2021-10-20 17:14:23 +0100 | [diff] [blame] | 48 | if(GEN_FILES) |
Manuel Pégourié-Gonnard | e90e405 | 2021-09-08 13:27:09 +0200 | [diff] [blame] | 49 | add_dependencies(${exe} generate_query_config_c) |
| 50 | endif() |
Manuel Pégourié-Gonnard | 86cfa6c | 2021-05-14 10:07:33 +0200 | [diff] [blame] | 51 | endif() |
Ronald Cron | bfd45f1 | 2020-06-05 11:15:31 +0200 | [diff] [blame] | 52 | endforeach() |
Paul Bakker | b06819b | 2011-01-18 16:18:38 +0000 | [diff] [blame] | 53 | |
Paul Bakker | f9c4953 | 2013-12-19 15:40:58 +0100 | [diff] [blame] | 54 | if(THREADS_FOUND) |
Ronald Cron | 8dc0af2 | 2020-06-05 16:00:22 +0200 | [diff] [blame] | 55 | add_executable(ssl_pthread_server ssl_pthread_server.c $<TARGET_OBJECTS:mbedtls_test>) |
David Horstmann | 1d9b033 | 2024-11-04 14:18:27 +0000 | [diff] [blame] | 56 | target_include_directories(ssl_pthread_server PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../framework/tests/include |
| 57 | ${CMAKE_CURRENT_SOURCE_DIR}/../../tests/include) |
Paul Bakker | 3e72f6e | 2013-12-30 15:25:08 +0100 | [diff] [blame] | 58 | target_link_libraries(ssl_pthread_server ${libs} ${CMAKE_THREAD_LIBS_INIT}) |
Ronald Cron | bfd45f1 | 2020-06-05 11:15:31 +0200 | [diff] [blame] | 59 | list(APPEND executables ssl_pthread_server) |
Paul Bakker | f9c4953 | 2013-12-19 15:40:58 +0100 | [diff] [blame] | 60 | endif(THREADS_FOUND) |
| 61 | |
Ronald Cron | bfd45f1 | 2020-06-05 11:15:31 +0200 | [diff] [blame] | 62 | install(TARGETS ${executables} |
Paul Bakker | 547f73d | 2011-01-05 15:07:54 +0000 | [diff] [blame] | 63 | DESTINATION "bin" |
| 64 | PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) |