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 <david.horstmann@arm.com>
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index d25f772..5369246 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -16,15 +16,22 @@
# 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 @@
${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()