From 5ecea2ff63c36afc2dad77f33899bdf9eb260e51 Mon Sep 17 00:00:00 2001 From: David Faure Date: Wed, 12 Sep 2018 21:03:34 +0200 Subject: autotests: actually iterate over the list, rather than checking item 0 all the time Found while grepping for examples of foreach(... RANGE ...) for my cmake training material ;-) --- tests/ECMGeneratePkgConfigFile/run_test.cmake.config | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/ECMGeneratePkgConfigFile/run_test.cmake.config b/tests/ECMGeneratePkgConfigFile/run_test.cmake.config index 5885c97f..45b3d26d 100644 --- a/tests/ECMGeneratePkgConfigFile/run_test.cmake.config +++ b/tests/ECMGeneratePkgConfigFile/run_test.cmake.config @@ -15,15 +15,16 @@ function (compare_files) set(multiValueArgs) cmake_parse_arguments(CF "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) list(LENGTH CF_GENERATED count) - foreach(i RANGE ${count}) - list(GET CF_GENERATED 0 generated_file) + math(EXPR last "${count}-1") + foreach(i RANGE ${last}) + list(GET CF_GENERATED ${i} generated_file) if (NOT EXISTS "${generated_file}") message(FATAL_ERROR "${generated_file} was not generated") endif() file(READ "${generated_file}" file_contents) string(STRIP "${file_contents}" file_contents) - list(GET CF_ORIGINALS 0 original_file) + list(GET CF_ORIGINALS ${i} original_file) if (NOT EXISTS "${original_file}") message(FATAL_ERROR "Original ${original_file} was not found") endif() -- cgit v1.2.1