CMakeLists.txt 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. set(THREADS_USE_PTHREADS_WIN32 true)
  2. find_package(Threads)
  3. set(libs
  4. ${mbedtls_target}
  5. )
  6. if(USE_PKCS11_HELPER_LIBRARY)
  7. set(libs ${libs} pkcs11-helper)
  8. endif(USE_PKCS11_HELPER_LIBRARY)
  9. if(ENABLE_ZLIB_SUPPORT)
  10. set(libs ${libs} ${ZLIB_LIBRARIES})
  11. endif(ENABLE_ZLIB_SUPPORT)
  12. set(executables
  13. dtls_client
  14. dtls_server
  15. mini_client
  16. ssl_client1
  17. ssl_client2
  18. ssl_context_info
  19. ssl_fork_server
  20. ssl_mail_client
  21. ssl_server
  22. ssl_server2
  23. )
  24. foreach(exe IN LISTS executables)
  25. set(extra_sources "")
  26. if(exe STREQUAL "ssl_client2" OR exe STREQUAL "ssl_server2")
  27. list(APPEND extra_sources
  28. ${CMAKE_CURRENT_SOURCE_DIR}/../test/query_config.c)
  29. endif()
  30. add_executable(${exe} ${exe}.c $<TARGET_OBJECTS:mbedtls_test>
  31. ${extra_sources})
  32. target_link_libraries(${exe} ${libs})
  33. target_include_directories(${exe} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../tests/include)
  34. endforeach()
  35. set_property(TARGET ssl_client2 APPEND PROPERTY SOURCES
  36. ssl_test_lib.c ${CMAKE_CURRENT_SOURCE_DIR}/../test/query_config.c)
  37. set_property(TARGET ssl_server2 APPEND PROPERTY SOURCES
  38. ssl_test_lib.c ${CMAKE_CURRENT_SOURCE_DIR}/../test/query_config.c)
  39. if(THREADS_FOUND)
  40. add_executable(ssl_pthread_server ssl_pthread_server.c $<TARGET_OBJECTS:mbedtls_test>)
  41. target_link_libraries(ssl_pthread_server ${libs} ${CMAKE_THREAD_LIBS_INIT})
  42. list(APPEND executables ssl_pthread_server)
  43. endif(THREADS_FOUND)
  44. install(TARGETS ${executables}
  45. DESTINATION "bin"
  46. PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)