blob: 49b44e70765a5ce315c7fb517a45f2ab7a4e41cb [file] [log] [blame]
Paul Bakkerb06819b2011-01-18 16:18:38 +00001set(libs
Raef Coles995c66f2020-10-13 16:30:41 +01002 ${mbedtls_target}
Paul Bakkerb06819b2011-01-18 16:18:38 +00003)
4
5if(USE_PKCS11_HELPER_LIBRARY)
6 set(libs ${libs} pkcs11-helper)
7endif(USE_PKCS11_HELPER_LIBRARY)
8
Paul Bakker92eeea42012-07-03 15:10:33 +00009if(ENABLE_ZLIB_SUPPORT)
10 set(libs ${libs} ${ZLIB_LIBRARIES})
11endif(ENABLE_ZLIB_SUPPORT)
12
Ronald Cronbfd45f12020-06-05 11:15:31 +020013set(executables_libs
14 selftest
15 udp_proxy
16)
Paul Bakker367dae42009-06-28 21:50:27 +000017
Ronald Cronbfd45f12020-06-05 11:15:31 +020018set(executables_mbedcrypto
19 benchmark
20 query_compile_time_config
21 zeroize
22)
Paul Bakker367dae42009-06-28 21:50:27 +000023
Andrzej Kurek0211c322018-03-15 05:16:24 -040024if(TEST_CPP)
Ronald Cronbfd45f12020-06-05 11:15:31 +020025 list(APPEND executables_mbedcrypto cpp_dummy_build)
Andrzej Kurek0211c322018-03-15 05:16:24 -040026endif()
27
Ronald Cronbfd45f12020-06-05 11:15:31 +020028foreach(exe IN LISTS executables_libs executables_mbedcrypto)
Ronald Cron8dc0af22020-06-05 16:00:22 +020029 add_executable(${exe} ${exe}.c $<TARGET_OBJECTS:mbedtls_test>)
Manuel Pégourié-Gonnardcb4137b2014-09-04 14:55:28 +020030
Ronald Cronbfd45f12020-06-05 11:15:31 +020031 # This emulates "if ( ... IN_LIST ... )" which becomes available in CMake 3.3
32 list(FIND executables_libs ${exe} exe_index)
33 if (${exe_index} GREATER -1)
34 target_link_libraries(${exe} ${libs})
35 else()
Raef Coles995c66f2020-10-13 16:30:41 +010036 target_link_libraries(${exe} ${mbedcrypto_target})
Ronald Cronbfd45f12020-06-05 11:15:31 +020037 endif()
38endforeach()
Andres Amaya Garcia5ab74a12017-10-24 21:10:45 +010039
David Brown381c1072020-11-03 15:36:44 -070040set_property(TARGET query_compile_time_config APPEND PROPERTY SOURCES
41 ${CMAKE_CURRENT_SOURCE_DIR}/query_config.c)
Andres AG509ba692018-10-26 18:41:08 +010042
Ronald Cronbfd45f12020-06-05 11:15:31 +020043install(TARGETS ${executables_libs} ${executables_mbedcrypto}
Paul Bakker547f73d2011-01-05 15:07:54 +000044 DESTINATION "bin"
45 PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)