Paul Bakker | 3e72f6e | 2013-12-30 15:25:08 +0100 | [diff] [blame] | 1 | set(THREADS_USE_PTHREADS_WIN32 true) |
Paul Bakker | f9c4953 | 2013-12-19 15:40:58 +0100 | [diff] [blame] | 2 | find_package(Threads) |
| 3 | |
Paul Bakker | b06819b | 2011-01-18 16:18:38 +0000 | [diff] [blame] | 4 | set(libs |
Raef Coles | 995c66f | 2020-10-13 16:30:41 +0100 | [diff] [blame] | 5 | ${mbedtls_target} |
Paul Bakker | b06819b | 2011-01-18 16:18:38 +0000 | [diff] [blame] | 6 | ) |
| 7 | |
Ronald Cron | bfd45f1 | 2020-06-05 11:15:31 +0200 | [diff] [blame] | 8 | if(USE_PKCS11_HELPER_LIBRARY) |
| 9 | set(libs ${libs} pkcs11-helper) |
| 10 | endif(USE_PKCS11_HELPER_LIBRARY) |
| 11 | |
| 12 | if(ENABLE_ZLIB_SUPPORT) |
| 13 | set(libs ${libs} ${ZLIB_LIBRARIES}) |
| 14 | endif(ENABLE_ZLIB_SUPPORT) |
| 15 | |
| 16 | set(executables |
Manuel Pégourié-Gonnard | 216a183 | 2015-06-25 09:20:03 +0200 | [diff] [blame] | 17 | dtls_client |
| 18 | dtls_server |
Manuel Pégourié-Gonnard | 6f83025 | 2020-04-03 11:56:06 +0200 | [diff] [blame] | 19 | mini_client |
Manuel Pégourié-Gonnard | 216a183 | 2015-06-25 09:20:03 +0200 | [diff] [blame] | 20 | ssl_client1 |
| 21 | ssl_client2 |
Ronald Cron | 2773113 | 2020-06-05 11:51:28 +0200 | [diff] [blame] | 22 | ssl_context_info |
Manuel Pégourié-Gonnard | 216a183 | 2015-06-25 09:20:03 +0200 | [diff] [blame] | 23 | ssl_fork_server |
| 24 | ssl_mail_client |
Manuel Pégourié-Gonnard | 6f83025 | 2020-04-03 11:56:06 +0200 | [diff] [blame] | 25 | ssl_server |
Ronald Cron | 2773113 | 2020-06-05 11:51:28 +0200 | [diff] [blame] | 26 | ssl_server2 |
Paul Bakker | f9c4953 | 2013-12-19 15:40:58 +0100 | [diff] [blame] | 27 | ) |
| 28 | |
Ronald Cron | bfd45f1 | 2020-06-05 11:15:31 +0200 | [diff] [blame] | 29 | foreach(exe IN LISTS executables) |
David Brown | a8e309e | 2020-11-18 15:07:24 -0700 | [diff] [blame] | 30 | set(extra_sources "") |
| 31 | if(exe STREQUAL "ssl_client2" OR exe STREQUAL "ssl_server2") |
| 32 | list(APPEND extra_sources |
| 33 | ${CMAKE_CURRENT_SOURCE_DIR}/../test/query_config.c) |
| 34 | endif() |
| 35 | add_executable(${exe} ${exe}.c $<TARGET_OBJECTS:mbedtls_test> |
| 36 | ${extra_sources}) |
Ronald Cron | bfd45f1 | 2020-06-05 11:15:31 +0200 | [diff] [blame] | 37 | target_link_libraries(${exe} ${libs}) |
Ronald Cron | 8dc0af2 | 2020-06-05 16:00:22 +0200 | [diff] [blame] | 38 | target_include_directories(${exe} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../tests/include) |
Ronald Cron | bfd45f1 | 2020-06-05 11:15:31 +0200 | [diff] [blame] | 39 | endforeach() |
Paul Bakker | b06819b | 2011-01-18 16:18:38 +0000 | [diff] [blame] | 40 | |
Gilles Peskine | a3ed34f | 2021-01-05 21:11:16 +0100 | [diff] [blame] | 41 | set_property(TARGET ssl_client2 APPEND PROPERTY SOURCES |
| 42 | ssl_test_lib.c ${CMAKE_CURRENT_SOURCE_DIR}/../test/query_config.c) |
| 43 | set_property(TARGET ssl_server2 APPEND PROPERTY SOURCES |
| 44 | ssl_test_lib.c ${CMAKE_CURRENT_SOURCE_DIR}/../test/query_config.c) |
Manuel Pégourié-Gonnard | a6fc5b2 | 2014-11-24 14:05:25 +0100 | [diff] [blame] | 45 | |
Paul Bakker | f9c4953 | 2013-12-19 15:40:58 +0100 | [diff] [blame] | 46 | if(THREADS_FOUND) |
Ronald Cron | 8dc0af2 | 2020-06-05 16:00:22 +0200 | [diff] [blame] | 47 | add_executable(ssl_pthread_server ssl_pthread_server.c $<TARGET_OBJECTS:mbedtls_test>) |
Mateusz Starzyk | 1aec646 | 2021-02-08 15:34:42 +0100 | [diff] [blame^] | 48 | target_include_directories(ssl_pthread_server PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../tests/include) |
Paul Bakker | 3e72f6e | 2013-12-30 15:25:08 +0100 | [diff] [blame] | 49 | target_link_libraries(ssl_pthread_server ${libs} ${CMAKE_THREAD_LIBS_INIT}) |
Ronald Cron | bfd45f1 | 2020-06-05 11:15:31 +0200 | [diff] [blame] | 50 | list(APPEND executables ssl_pthread_server) |
Paul Bakker | f9c4953 | 2013-12-19 15:40:58 +0100 | [diff] [blame] | 51 | endif(THREADS_FOUND) |
| 52 | |
Ronald Cron | bfd45f1 | 2020-06-05 11:15:31 +0200 | [diff] [blame] | 53 | install(TARGETS ${executables} |
Paul Bakker | 547f73d | 2011-01-05 15:07:54 +0000 | [diff] [blame] | 54 | DESTINATION "bin" |
| 55 | PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) |