From 80bc860aab44e951c6c75a8ed58dd3fd9c335ada Mon Sep 17 00:00:00 2001 From: Jerry Yu Date: Mon, 17 Jan 2022 18:26:52 +0800 Subject: [PATCH] add depends to avoid file not found Signed-off-by: Jerry Yu --- tests/CMakeLists.txt | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 2f5426469..c87623c67 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -50,18 +50,18 @@ if(GEN_FILES) ${CMAKE_CURRENT_SOURCE_DIR}/../include/psa/crypto_values.h ${CMAKE_CURRENT_SOURCE_DIR}/../include/psa/crypto_extra.h ) - # CMake generate sub-makefile for each target and call it in subprocess. Without - # this command, cmake will generate ruler in each sub makefile. As a result, - # they will conflict under parllel build. - # With this line, only 4 sub-makefiles include above command, that reduces - # conflict risk. - add_custom_target(test_suite_generated_data DEPENDS ${generated_data_files}) + else() foreach(file ${base_generated_data_files}) link_to_source(${file}) endforeach() endif() - +# CMake generate sub-makefile for each target and call it in subprocess. Without +# this command, cmake will generate ruler in each sub makefile. As a result, +# they will conflict under parllel build. +# With this line, only 4 sub-makefiles include above command, that reduces +# conflict risk. +add_custom_target(test_suite_generated_data DEPENDS ${generated_data_files}) # Test suites caught by SKIP_TEST_SUITES are built but not executed. # "foo" as a skip pattern skips "test_suite_foo" and "test_suite_foo.bar" # but not "test_suite_foobar". @@ -125,6 +125,7 @@ function(add_test_suite suite_name) ) add_executable(test_suite_${data_name} test_suite_${data_name}.c $) + add_dependencies(test_suite_${data_name} test_suite_generated_data) target_link_libraries(test_suite_${data_name} ${libs}) # Include test-specific header files from ./include and private header # files (used by some invasive tests) from ../library. Public header