From 7570d24d3d9336aa57373b4b71cadfae9074e422 Mon Sep 17 00:00:00 2001 From: David Horstmann Date: Wed, 20 Oct 2021 16:27:24 +0100 Subject: [PATCH] Fix issue with DEV_MODE=OFF case When DEV_MODE=OFF, link_to_source() was being called with a full path in the build directory, rather than just a base name starting at "suites/" as was intended. Fix this by generating a list of base names and using that for link_to_source(), then deriving full paths afterwards. Signed-off-by: David Horstmann --- tests/CMakeLists.txt | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index d25f77239..53692465b 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -16,15 +16,22 @@ endif() # generated .data files will go there file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/suites) +# Get base names for generated files (starting at "suites/") execute_process( COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/../tests/scripts/generate_psa_tests.py --list-for-cmake - --directory ${CMAKE_CURRENT_BINARY_DIR}/suites + --directory suites WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/.. OUTPUT_VARIABLE - generated_data_files) + base_generated_data_files) + +# Derive generated file paths in the build directory +set(generated_data_files "") +foreach(file ${base_generated_data_files}) + list(APPEND generated_data_files ${CMAKE_CURRENT_BINARY_DIR}/${file}) +endforeach() if(DEV_MODE) add_custom_command( @@ -43,7 +50,7 @@ if(DEV_MODE) ${CMAKE_CURRENT_SOURCE_DIR}/../include/psa/crypto_extra.h ) else() - foreach(file ${generated_data_files}) + foreach(file ${base_generated_data_files}) link_to_source(${file}) endforeach() endif()