From 5dab92ee4e5c189ee201c1e1b42252258f5d6e73 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Sat, 14 Sep 2024 12:13:16 +0200 Subject: [PATCH] CMake: support "make programs" Signed-off-by: Gilles Peskine --- programs/CMakeLists.txt | 3 +++ programs/aes/CMakeLists.txt | 1 + programs/cipher/CMakeLists.txt | 1 + programs/fuzz/CMakeLists.txt | 2 ++ programs/hash/CMakeLists.txt | 1 + programs/pkey/CMakeLists.txt | 2 ++ programs/psa/CMakeLists.txt | 1 + programs/random/CMakeLists.txt | 1 + programs/ssl/CMakeLists.txt | 1 + programs/test/CMakeLists.txt | 2 ++ programs/util/CMakeLists.txt | 1 + programs/x509/CMakeLists.txt | 1 + 12 files changed, 17 insertions(+) diff --git a/programs/CMakeLists.txt b/programs/CMakeLists.txt index 0633aa6499..aaf93ba38d 100644 --- a/programs/CMakeLists.txt +++ b/programs/CMakeLists.txt @@ -1,3 +1,6 @@ +set(programs_target "${MBEDTLS_TARGET_PREFIX}programs") +add_custom_target(${programs_target}) + add_subdirectory(aes) add_subdirectory(cipher) if (NOT WIN32) diff --git a/programs/aes/CMakeLists.txt b/programs/aes/CMakeLists.txt index ccb8db564f..4d4c890fbf 100644 --- a/programs/aes/CMakeLists.txt +++ b/programs/aes/CMakeLists.txt @@ -1,6 +1,7 @@ set(executables crypt_and_hash ) +add_dependencies(${programs_target} ${executables}) foreach(exe IN LISTS executables) add_executable(${exe} ${exe}.c $) diff --git a/programs/cipher/CMakeLists.txt b/programs/cipher/CMakeLists.txt index e925524f68..effaf8a931 100644 --- a/programs/cipher/CMakeLists.txt +++ b/programs/cipher/CMakeLists.txt @@ -1,6 +1,7 @@ set(executables cipher_aead_demo ) +add_dependencies(${programs_target} ${executables}) foreach(exe IN LISTS executables) add_executable(${exe} ${exe}.c $) diff --git a/programs/fuzz/CMakeLists.txt b/programs/fuzz/CMakeLists.txt index c389029bca..f5358ffff6 100644 --- a/programs/fuzz/CMakeLists.txt +++ b/programs/fuzz/CMakeLists.txt @@ -15,6 +15,7 @@ set(executables_no_common_c fuzz_x509csr fuzz_pkcs7 ) +add_dependencies(${programs_target} ${executables_no_common_c}) set(executables_with_common_c fuzz_privkey @@ -23,6 +24,7 @@ set(executables_with_common_c fuzz_dtlsserver fuzz_server ) +add_dependencies(${programs_target} ${executables_with_common_c}) foreach(exe IN LISTS executables_no_common_c executables_with_common_c) diff --git a/programs/hash/CMakeLists.txt b/programs/hash/CMakeLists.txt index fcacf3ba4f..0ad974d9a9 100644 --- a/programs/hash/CMakeLists.txt +++ b/programs/hash/CMakeLists.txt @@ -3,6 +3,7 @@ set(executables hello md_hmac_demo ) +add_dependencies(${programs_target} ${executables}) foreach(exe IN LISTS executables) add_executable(${exe} ${exe}.c $) diff --git a/programs/pkey/CMakeLists.txt b/programs/pkey/CMakeLists.txt index cd0387a882..defbe281d9 100644 --- a/programs/pkey/CMakeLists.txt +++ b/programs/pkey/CMakeLists.txt @@ -2,6 +2,7 @@ set(executables_mbedtls dh_client dh_server ) +add_dependencies(${programs_target} ${executables_mbedtls}) foreach(exe IN LISTS executables_mbedtls) add_executable(${exe} ${exe}.c $) @@ -29,6 +30,7 @@ set(executables_mbedcrypto rsa_verify rsa_verify_pss ) +add_dependencies(${programs_target} ${executables_mbedcrypto}) foreach(exe IN LISTS executables_mbedcrypto) add_executable(${exe} ${exe}.c $) diff --git a/programs/psa/CMakeLists.txt b/programs/psa/CMakeLists.txt index c0843e1233..cfc983c19c 100644 --- a/programs/psa/CMakeLists.txt +++ b/programs/psa/CMakeLists.txt @@ -6,6 +6,7 @@ set(executables psa_constant_names psa_hash ) +add_dependencies(${programs_target} ${executables}) if(GEN_FILES) add_custom_command( diff --git a/programs/random/CMakeLists.txt b/programs/random/CMakeLists.txt index 5940395354..f0c78259ff 100644 --- a/programs/random/CMakeLists.txt +++ b/programs/random/CMakeLists.txt @@ -2,6 +2,7 @@ set(executables gen_entropy gen_random_ctr_drbg ) +add_dependencies(${programs_target} ${executables}) foreach(exe IN LISTS executables) add_executable(${exe} ${exe}.c $) diff --git a/programs/ssl/CMakeLists.txt b/programs/ssl/CMakeLists.txt index ec2c86fb4a..f4fb477ebf 100644 --- a/programs/ssl/CMakeLists.txt +++ b/programs/ssl/CMakeLists.txt @@ -16,6 +16,7 @@ set(executables ssl_server ssl_server2 ) +add_dependencies(${programs_target} ${executables}) if(GEN_FILES) # Inform CMake that the following file will be generated as part of the build diff --git a/programs/test/CMakeLists.txt b/programs/test/CMakeLists.txt index 0c9b11a4b0..f25dd7a54c 100644 --- a/programs/test/CMakeLists.txt +++ b/programs/test/CMakeLists.txt @@ -8,12 +8,14 @@ set(executables_libs selftest udp_proxy ) +add_dependencies(${programs_target} ${executables_libs}) set(executables_mbedcrypto benchmark query_compile_time_config zeroize ) +add_dependencies(${programs_target} ${executables_mbedcrypto}) if(TEST_CPP) set(cpp_dummy_build_cpp "${CMAKE_CURRENT_BINARY_DIR}/cpp_dummy_build.cpp") diff --git a/programs/util/CMakeLists.txt b/programs/util/CMakeLists.txt index cb6bc3d2d2..264d9416cc 100644 --- a/programs/util/CMakeLists.txt +++ b/programs/util/CMakeLists.txt @@ -6,6 +6,7 @@ set(executables pem2der strerror ) +add_dependencies(${programs_target} ${executables}) foreach(exe IN LISTS executables) add_executable(${exe} ${exe}.c $) diff --git a/programs/x509/CMakeLists.txt b/programs/x509/CMakeLists.txt index 43437f070b..a09813c917 100644 --- a/programs/x509/CMakeLists.txt +++ b/programs/x509/CMakeLists.txt @@ -10,6 +10,7 @@ set(executables load_roots req_app ) +add_dependencies(${programs_target} ${executables}) foreach(exe IN LISTS executables) add_executable(${exe} ${exe}.c $)