1set(THREADS_USE_PTHREADS_WIN32 true)
2find_package(Threads)
3
4set(libs
5    mbedtls
6)
7
8set(targets
9    dtls_client
10    dtls_server
11    ssl_client1
12    ssl_client2
13    ssl_server
14    ssl_fork_server
15    ssl_mail_client
16    mini_client
17)
18
19if(USE_PKCS11_HELPER_LIBRARY)
20    set(libs ${libs} pkcs11-helper)
21endif(USE_PKCS11_HELPER_LIBRARY)
22
23if(ENABLE_ZLIB_SUPPORT)
24    set(libs ${libs} ${ZLIB_LIBRARIES})
25endif(ENABLE_ZLIB_SUPPORT)
26
27add_executable(dtls_client dtls_client.c)
28target_link_libraries(dtls_client ${libs})
29
30add_executable(dtls_server dtls_server.c)
31target_link_libraries(dtls_server ${libs})
32
33add_executable(ssl_client1 ssl_client1.c)
34target_link_libraries(ssl_client1 ${libs})
35
36add_executable(ssl_client2 ssl_client2.c)
37target_link_libraries(ssl_client2 ${libs})
38
39add_executable(ssl_server ssl_server.c)
40target_link_libraries(ssl_server ${libs})
41
42add_executable(ssl_server2 ssl_server2.c)
43target_link_libraries(ssl_server2 ${libs})
44
45add_executable(ssl_fork_server ssl_fork_server.c)
46target_link_libraries(ssl_fork_server ${libs})
47
48add_executable(ssl_mail_client ssl_mail_client.c)
49target_link_libraries(ssl_mail_client ${libs})
50
51add_executable(mini_client mini_client.c)
52target_link_libraries(mini_client ${libs})
53
54if(THREADS_FOUND)
55    add_executable(ssl_pthread_server ssl_pthread_server.c)
56    target_link_libraries(ssl_pthread_server ${libs} ${CMAKE_THREAD_LIBS_INIT})
57    set(targets ${targets} ssl_pthread_server)
58endif(THREADS_FOUND)
59
60install(TARGETS ${targets}
61        DESTINATION "bin"
62        PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
63