CMakeLists.txt (2476B)
1 find_package(Threads) 2 3 set(libs 4 ${mbedtls_target} 5 ) 6 7 set(executables 8 dtls_client 9 dtls_server 10 mini_client 11 ssl_client1 12 ssl_client2 13 ssl_context_info 14 ssl_fork_server 15 ssl_mail_client 16 ssl_server 17 ssl_server2 18 ) 19 add_dependencies(${programs_target} ${executables}) 20 add_dependencies(${ssl_opt_target} ${executables}) 21 22 if(GEN_FILES) 23 # Inform CMake that the following file will be generated as part of the build 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 26 # propagate this information across the tree, for now it's only visible 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() 32 33 foreach(exe IN LISTS executables) 34 set(extra_sources "") 35 if(exe STREQUAL "ssl_client2" OR exe STREQUAL "ssl_server2") 36 list(APPEND extra_sources 37 ssl_test_lib.c 38 ${MBEDTLS_FRAMEWORK_DIR}/tests/programs/query_config.h 39 ${CMAKE_CURRENT_BINARY_DIR}/../test/query_config.c) 40 endif() 41 add_executable(${exe} ${exe}.c $<TARGET_OBJECTS:mbedtls_test> 42 ${extra_sources}) 43 target_link_libraries(${exe} ${libs} ${CMAKE_THREAD_LIBS_INIT}) 44 target_include_directories(${exe} PRIVATE ${MBEDTLS_FRAMEWORK_DIR}/tests/programs 45 ${MBEDTLS_FRAMEWORK_DIR}/tests/include 46 ${CMAKE_CURRENT_SOURCE_DIR}/../../tests/include) 47 if(exe STREQUAL "ssl_client2" OR exe STREQUAL "ssl_server2") 48 if(GEN_FILES) 49 add_dependencies(${exe} generate_query_config_c) 50 endif() 51 endif() 52 endforeach() 53 54 if(THREADS_FOUND) 55 add_executable(ssl_pthread_server ssl_pthread_server.c $<TARGET_OBJECTS:mbedtls_test>) 56 target_include_directories(ssl_pthread_server PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../framework/tests/include 57 ${CMAKE_CURRENT_SOURCE_DIR}/../../tests/include) 58 target_link_libraries(ssl_pthread_server ${libs} ${CMAKE_THREAD_LIBS_INIT}) 59 list(APPEND executables ssl_pthread_server) 60 endif(THREADS_FOUND) 61 62 install(TARGETS ${executables} 63 DESTINATION "bin" 64 PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)