mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-16 08:42:50 +00:00
cmake: tf-psa-crypto: Add cmake_subproject test program
The empty framework directory is temporary. It will be removed when TF-PSA-Crypto uses its framework submodule. Signed-off-by: Ronald Cron <ronald.cron@arm.com>
This commit is contained in:
parent
1a52bc4802
commit
020e026779
3
tf-psa-crypto/programs/test/cmake_subproject/.gitignore
vendored
Normal file
3
tf-psa-crypto/programs/test/cmake_subproject/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
build
|
||||
Makefile
|
||||
cmake_subproject
|
18
tf-psa-crypto/programs/test/cmake_subproject/CMakeLists.txt
Normal file
18
tf-psa-crypto/programs/test/cmake_subproject/CMakeLists.txt
Normal file
@ -0,0 +1,18 @@
|
||||
cmake_minimum_required(VERSION 3.5.1)
|
||||
|
||||
# Test the target renaming support by adding a prefix to the targets built
|
||||
set(TF_PSA_CRYPTO_TARGET_PREFIX subproject_test_)
|
||||
|
||||
# We use the parent TF-PSA-Crypto directory as the TF_PSA_CRYPTO_DIR for this
|
||||
# test. Other projects that use TF-PSA-Crypto as a subproject are likely to
|
||||
# add by their own relative paths.
|
||||
set(TF_PSA_CRYPTO_DIR ../../../)
|
||||
|
||||
# Add TF-PSA-Crypto as a subdirectory.
|
||||
add_subdirectory(${TF_PSA_CRYPTO_DIR} build)
|
||||
|
||||
# Link against all the TF-PSA-Crypto library. Verifies that the target has been
|
||||
# created using the specified prefix
|
||||
|
||||
add_executable(cmake_subproject cmake_subproject.c)
|
||||
target_link_libraries(cmake_subproject subproject_test_mbedcrypto ${CMAKE_THREAD_LIBS_INIT})
|
@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Simple program to test that CMake builds with TF-PSA-Crypto as a
|
||||
* subdirectory work correctly.
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include <psa/crypto.h>
|
||||
|
||||
/* The main reason to build this is for testing the CMake build, so the program
|
||||
* doesn't need to do very much. It calls a PSA cryptography API to ensure
|
||||
* linkage works, but that is all. */
|
||||
int main()
|
||||
{
|
||||
psa_crypto_init();
|
||||
|
||||
return 0;
|
||||
}
|
0
tf-psa-crypto/programs/test/cmake_subproject/framework/.gitignore
vendored
Normal file
0
tf-psa-crypto/programs/test/cmake_subproject/framework/.gitignore
vendored
Normal file
@ -22,3 +22,12 @@ component_test_tf_psa_crypto_cmake_out_of_source () {
|
||||
cd "$TF_PSA_CRYPTO_ROOT_DIR"
|
||||
rm -rf "$OUT_OF_SOURCE_DIR"
|
||||
}
|
||||
|
||||
component_test_tf_psa_crypto_cmake_as_subdirectory () {
|
||||
msg "build: cmake 'as-subdirectory' build"
|
||||
cd programs/test/cmake_subproject
|
||||
# Note: Explicitly generate files as these are turned off in releases
|
||||
cmake -D GEN_FILES=ON .
|
||||
make
|
||||
./cmake_subproject
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user