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