programs: cmake: Use list of executables
Use list of executables to:
- factorize the code to define executables
- highlight the similarities and differences of the executable definitions
- avoid list duplication
Use alphabetic order for executables in lists.
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
diff --git a/programs/hash/CMakeLists.txt b/programs/hash/CMakeLists.txt
index 3c6cca9..0b4a1c5 100644
--- a/programs/hash/CMakeLists.txt
+++ b/programs/hash/CMakeLists.txt
@@ -1,9 +1,13 @@
-add_executable(hello hello.c)
-target_link_libraries(hello mbedcrypto)
+set(executables
+ generic_sum
+ hello
+)
-add_executable(generic_sum generic_sum.c)
-target_link_libraries(generic_sum mbedcrypto)
+foreach(exe IN LISTS executables)
+ add_executable(${exe} ${exe}.c)
+ target_link_libraries(${exe} mbedcrypto)
+endforeach()
-install(TARGETS hello generic_sum
+install(TARGETS ${executables}
DESTINATION "bin"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)