blob: e8fc930821c69bef588436ef527dd858ffc4bc18 [file] [log] [blame]
Paul Bakker3e72f6e2013-12-30 15:25:08 +01001set(THREADS_USE_PTHREADS_WIN32 true)
Paul Bakkerf9c49532013-12-19 15:40:58 +01002find_package(Threads)
3
Paul Bakkerb06819b2011-01-18 16:18:38 +00004set(libs
Raef Coles995c66f2020-10-13 16:30:41 +01005 ${mbedtls_target}
Paul Bakkerb06819b2011-01-18 16:18:38 +00006)
7
Ronald Cronbfd45f12020-06-05 11:15:31 +02008if(USE_PKCS11_HELPER_LIBRARY)
9 set(libs ${libs} pkcs11-helper)
10endif(USE_PKCS11_HELPER_LIBRARY)
11
12if(ENABLE_ZLIB_SUPPORT)
13 set(libs ${libs} ${ZLIB_LIBRARIES})
14endif(ENABLE_ZLIB_SUPPORT)
15
16set(executables
Manuel Pégourié-Gonnard216a1832015-06-25 09:20:03 +020017 dtls_client
18 dtls_server
Manuel Pégourié-Gonnard6f830252020-04-03 11:56:06 +020019 mini_client
Manuel Pégourié-Gonnard216a1832015-06-25 09:20:03 +020020 ssl_client1
21 ssl_client2
Ronald Cron27731132020-06-05 11:51:28 +020022 ssl_context_info
Manuel Pégourié-Gonnard216a1832015-06-25 09:20:03 +020023 ssl_fork_server
24 ssl_mail_client
Manuel Pégourié-Gonnard6f830252020-04-03 11:56:06 +020025 ssl_server
Ronald Cron27731132020-06-05 11:51:28 +020026 ssl_server2
Paul Bakkerf9c49532013-12-19 15:40:58 +010027)
28
Ronald Cronbfd45f12020-06-05 11:15:31 +020029foreach(exe IN LISTS executables)
David Browna8e309e2020-11-18 15:07:24 -070030 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 Cronbfd45f12020-06-05 11:15:31 +020037 target_link_libraries(${exe} ${libs})
Ronald Cron8dc0af22020-06-05 16:00:22 +020038 target_include_directories(${exe} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../tests/include)
Ronald Cronbfd45f12020-06-05 11:15:31 +020039endforeach()
Paul Bakkerb06819b2011-01-18 16:18:38 +000040
Gilles Peskinea3ed34f2021-01-05 21:11:16 +010041set_property(TARGET ssl_client2 APPEND PROPERTY SOURCES
42 ssl_test_lib.c ${CMAKE_CURRENT_SOURCE_DIR}/../test/query_config.c)
43set_property(TARGET ssl_server2 APPEND PROPERTY SOURCES
44 ssl_test_lib.c ${CMAKE_CURRENT_SOURCE_DIR}/../test/query_config.c)
Manuel Pégourié-Gonnarda6fc5b22014-11-24 14:05:25 +010045
Paul Bakkerf9c49532013-12-19 15:40:58 +010046if(THREADS_FOUND)
Ronald Cron8dc0af22020-06-05 16:00:22 +020047 add_executable(ssl_pthread_server ssl_pthread_server.c $<TARGET_OBJECTS:mbedtls_test>)
Mateusz Starzyk1aec6462021-02-08 15:34:42 +010048 target_include_directories(ssl_pthread_server PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../tests/include)
Paul Bakker3e72f6e2013-12-30 15:25:08 +010049 target_link_libraries(ssl_pthread_server ${libs} ${CMAKE_THREAD_LIBS_INIT})
Ronald Cronbfd45f12020-06-05 11:15:31 +020050 list(APPEND executables ssl_pthread_server)
Paul Bakkerf9c49532013-12-19 15:40:58 +010051endif(THREADS_FOUND)
52
Ronald Cronbfd45f12020-06-05 11:15:31 +020053install(TARGETS ${executables}
Paul Bakker547f73d2011-01-05 15:07:54 +000054 DESTINATION "bin"
55 PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)