Paul Bakker | b06819b | 2011-01-18 16:18:38 +0000 | [diff] [blame] | 1 | set(libs |
Raef Coles | 995c66f | 2020-10-13 16:30:41 +0100 | [diff] [blame] | 2 | ${mbedtls_target} |
Paul Bakker | b06819b | 2011-01-18 16:18:38 +0000 | [diff] [blame] | 3 | ) |
| 4 | |
| 5 | if(USE_PKCS11_HELPER_LIBRARY) |
| 6 | set(libs ${libs} pkcs11-helper) |
| 7 | endif(USE_PKCS11_HELPER_LIBRARY) |
| 8 | |
Paul Bakker | 92eeea4 | 2012-07-03 15:10:33 +0000 | [diff] [blame] | 9 | if(ENABLE_ZLIB_SUPPORT) |
| 10 | set(libs ${libs} ${ZLIB_LIBRARIES}) |
| 11 | endif(ENABLE_ZLIB_SUPPORT) |
| 12 | |
Ronald Cron | bfd45f1 | 2020-06-05 11:15:31 +0200 | [diff] [blame] | 13 | set(executables_libs |
| 14 | selftest |
| 15 | udp_proxy |
| 16 | ) |
Paul Bakker | 367dae4 | 2009-06-28 21:50:27 +0000 | [diff] [blame] | 17 | |
Ronald Cron | bfd45f1 | 2020-06-05 11:15:31 +0200 | [diff] [blame] | 18 | set(executables_mbedcrypto |
| 19 | benchmark |
| 20 | query_compile_time_config |
| 21 | zeroize |
| 22 | ) |
Paul Bakker | 367dae4 | 2009-06-28 21:50:27 +0000 | [diff] [blame] | 23 | |
Andrzej Kurek | 0211c32 | 2018-03-15 05:16:24 -0400 | [diff] [blame] | 24 | if(TEST_CPP) |
Ronald Cron | bfd45f1 | 2020-06-05 11:15:31 +0200 | [diff] [blame] | 25 | list(APPEND executables_mbedcrypto cpp_dummy_build) |
Andrzej Kurek | 0211c32 | 2018-03-15 05:16:24 -0400 | [diff] [blame] | 26 | endif() |
| 27 | |
Ronald Cron | bfd45f1 | 2020-06-05 11:15:31 +0200 | [diff] [blame] | 28 | foreach(exe IN LISTS executables_libs executables_mbedcrypto) |
David Brown | a8e309e | 2020-11-18 15:07:24 -0700 | [diff] [blame] | 29 | set(extra_sources "") |
| 30 | if(exe STREQUAL "query_compile_time_config") |
| 31 | list(APPEND extra_sources |
| 32 | ${CMAKE_CURRENT_SOURCE_DIR}/query_config.c) |
| 33 | endif() |
| 34 | add_executable(${exe} ${exe}.c $<TARGET_OBJECTS:mbedtls_test> |
| 35 | ${extra_sources}) |
Manuel Pégourié-Gonnard | cb4137b | 2014-09-04 14:55:28 +0200 | [diff] [blame] | 36 | |
Ronald Cron | bfd45f1 | 2020-06-05 11:15:31 +0200 | [diff] [blame] | 37 | # This emulates "if ( ... IN_LIST ... )" which becomes available in CMake 3.3 |
| 38 | list(FIND executables_libs ${exe} exe_index) |
| 39 | if (${exe_index} GREATER -1) |
| 40 | target_link_libraries(${exe} ${libs}) |
| 41 | else() |
Raef Coles | 995c66f | 2020-10-13 16:30:41 +0100 | [diff] [blame] | 42 | target_link_libraries(${exe} ${mbedcrypto_target}) |
Ronald Cron | bfd45f1 | 2020-06-05 11:15:31 +0200 | [diff] [blame] | 43 | endif() |
| 44 | endforeach() |
Andres Amaya Garcia | 5ab74a1 | 2017-10-24 21:10:45 +0100 | [diff] [blame] | 45 | |
Ronald Cron | bfd45f1 | 2020-06-05 11:15:31 +0200 | [diff] [blame] | 46 | install(TARGETS ${executables_libs} ${executables_mbedcrypto} |
Paul Bakker | 547f73d | 2011-01-05 15:07:54 +0000 | [diff] [blame] | 47 | DESTINATION "bin" |
| 48 | PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) |