CMake: support "make programs"

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
Gilles Peskine 2024-09-14 12:13:16 +02:00
parent 26fc0390c9
commit bb47c7368b
12 changed files with 17 additions and 0 deletions

View File

@ -1,3 +1,6 @@
set(programs_target "${MBEDTLS_TARGET_PREFIX}programs")
add_custom_target(${programs_target})
add_subdirectory(aes) add_subdirectory(aes)
add_subdirectory(cipher) add_subdirectory(cipher)
if (NOT WIN32) if (NOT WIN32)

View File

@ -1,6 +1,7 @@
set(executables set(executables
crypt_and_hash crypt_and_hash
) )
add_dependencies(${programs_target} ${executables})
foreach(exe IN LISTS executables) foreach(exe IN LISTS executables)
add_executable(${exe} ${exe}.c $<TARGET_OBJECTS:mbedtls_test>) add_executable(${exe} ${exe}.c $<TARGET_OBJECTS:mbedtls_test>)

View File

@ -1,6 +1,7 @@
set(executables set(executables
cipher_aead_demo cipher_aead_demo
) )
add_dependencies(${programs_target} ${executables})
foreach(exe IN LISTS executables) foreach(exe IN LISTS executables)
add_executable(${exe} ${exe}.c $<TARGET_OBJECTS:mbedtls_test>) add_executable(${exe} ${exe}.c $<TARGET_OBJECTS:mbedtls_test>)

View File

@ -15,6 +15,7 @@ set(executables_no_common_c
fuzz_x509csr fuzz_x509csr
fuzz_pkcs7 fuzz_pkcs7
) )
add_dependencies(${programs_target} ${executables_no_common_c})
set(executables_with_common_c set(executables_with_common_c
fuzz_privkey fuzz_privkey
@ -23,6 +24,7 @@ set(executables_with_common_c
fuzz_dtlsserver fuzz_dtlsserver
fuzz_server fuzz_server
) )
add_dependencies(${programs_target} ${executables_with_common_c})
foreach(exe IN LISTS executables_no_common_c executables_with_common_c) foreach(exe IN LISTS executables_no_common_c executables_with_common_c)

View File

@ -3,6 +3,7 @@ set(executables
hello hello
md_hmac_demo md_hmac_demo
) )
add_dependencies(${programs_target} ${executables})
foreach(exe IN LISTS executables) foreach(exe IN LISTS executables)
add_executable(${exe} ${exe}.c $<TARGET_OBJECTS:mbedtls_test>) add_executable(${exe} ${exe}.c $<TARGET_OBJECTS:mbedtls_test>)

View File

@ -2,6 +2,7 @@ set(executables_mbedtls
dh_client dh_client
dh_server dh_server
) )
add_dependencies(${programs_target} ${executables_mbedtls})
foreach(exe IN LISTS executables_mbedtls) foreach(exe IN LISTS executables_mbedtls)
add_executable(${exe} ${exe}.c $<TARGET_OBJECTS:mbedtls_test>) add_executable(${exe} ${exe}.c $<TARGET_OBJECTS:mbedtls_test>)
@ -29,6 +30,7 @@ set(executables_mbedcrypto
rsa_verify rsa_verify
rsa_verify_pss rsa_verify_pss
) )
add_dependencies(${programs_target} ${executables_mbedcrypto})
foreach(exe IN LISTS executables_mbedcrypto) foreach(exe IN LISTS executables_mbedcrypto)
add_executable(${exe} ${exe}.c $<TARGET_OBJECTS:mbedtls_test>) add_executable(${exe} ${exe}.c $<TARGET_OBJECTS:mbedtls_test>)

View File

@ -6,6 +6,7 @@ set(executables
psa_constant_names psa_constant_names
psa_hash psa_hash
) )
add_dependencies(${programs_target} ${executables})
if(GEN_FILES) if(GEN_FILES)
add_custom_command( add_custom_command(

View File

@ -2,6 +2,7 @@ set(executables
gen_entropy gen_entropy
gen_random_ctr_drbg gen_random_ctr_drbg
) )
add_dependencies(${programs_target} ${executables})
foreach(exe IN LISTS executables) foreach(exe IN LISTS executables)
add_executable(${exe} ${exe}.c $<TARGET_OBJECTS:mbedtls_test>) add_executable(${exe} ${exe}.c $<TARGET_OBJECTS:mbedtls_test>)

View File

@ -16,6 +16,7 @@ set(executables
ssl_server ssl_server
ssl_server2 ssl_server2
) )
add_dependencies(${programs_target} ${executables})
if(GEN_FILES) if(GEN_FILES)
# Inform CMake that the following file will be generated as part of the build # Inform CMake that the following file will be generated as part of the build

View File

@ -8,12 +8,14 @@ set(executables_libs
selftest selftest
udp_proxy udp_proxy
) )
add_dependencies(${programs_target} ${executables_libs})
set(executables_mbedcrypto set(executables_mbedcrypto
benchmark benchmark
query_compile_time_config query_compile_time_config
zeroize zeroize
) )
add_dependencies(${programs_target} ${executables_mbedcrypto})
if(TEST_CPP) if(TEST_CPP)
set(cpp_dummy_build_cpp "${CMAKE_CURRENT_BINARY_DIR}/cpp_dummy_build.cpp") set(cpp_dummy_build_cpp "${CMAKE_CURRENT_BINARY_DIR}/cpp_dummy_build.cpp")

View File

@ -6,6 +6,7 @@ set(executables
pem2der pem2der
strerror strerror
) )
add_dependencies(${programs_target} ${executables})
foreach(exe IN LISTS executables) foreach(exe IN LISTS executables)
add_executable(${exe} ${exe}.c $<TARGET_OBJECTS:mbedtls_test>) add_executable(${exe} ${exe}.c $<TARGET_OBJECTS:mbedtls_test>)

View File

@ -10,6 +10,7 @@ set(executables
load_roots load_roots
req_app req_app
) )
add_dependencies(${programs_target} ${executables})
foreach(exe IN LISTS executables) foreach(exe IN LISTS executables)
add_executable(${exe} ${exe}.c $<TARGET_OBJECTS:mbedtls_test>) add_executable(${exe} ${exe}.c $<TARGET_OBJECTS:mbedtls_test>)