diff options
author | David Faure <faure@kde.org> | 2018-09-12 21:03:34 +0200 |
---|---|---|
committer | David Faure <faure@kde.org> | 2018-09-12 21:03:34 +0200 |
commit | 5ecea2ff63c36afc2dad77f33899bdf9eb260e51 (patch) | |
tree | 06fdf5a17f47f9a9e197edd569c0e726cc90fde4 /tests | |
parent | 8e4cc151daf3e80bdf3c736d066a07e4c7a4ed1c (diff) | |
download | extra-cmake-modules-5ecea2ff63c36afc2dad77f33899bdf9eb260e51.tar.gz extra-cmake-modules-5ecea2ff63c36afc2dad77f33899bdf9eb260e51.tar.bz2 |
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 ;-)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ECMGeneratePkgConfigFile/run_test.cmake.config | 7 |
1 files changed, 4 insertions, 3 deletions
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() |