[LyX/2.3.x] Cmake tests: Make foreach() command robust
Kornel Benko
kornel at lyx.org
Tue Dec 31 10:21:34 UTC 2019
commit a99dc05e18018db28f4a485e4c9c31dd905681a0
Author: Kornel Benko <kornel at lyx.org>
Date: Sun Dec 15 13:38:23 2019 +0100
Cmake tests: Make foreach() command robust
Cmake's foreach command includes forms
foreach(<loop_var> IN LISTS <lists>)
foreach(<loop_var> IN ITEMS <items>)
foreach(<loop_var> RANGE ...)
We get the lines to be parsed by
file(STRINGS "${filepath}" lines)
If in the parsed lyx-file there is a line
containing only the single word 'IN', or 'RANGE', then
the command
foreach(_l ${lines})
can create a syntax error (at least with cmake1.16)
In fact, in file pl_Additional.lyx:12913 happens to have
such a beast.
(cherry picked from commit 7b44280da4fc015a4a930c311cc6073cebacf738)
---
development/autotests/ExportTests.cmake | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/development/autotests/ExportTests.cmake b/development/autotests/ExportTests.cmake
index 3b52058..bd34376 100644
--- a/development/autotests/ExportTests.cmake
+++ b/development/autotests/ExportTests.cmake
@@ -53,7 +53,7 @@ macro(getoutputformats filepath varname format_set)
# What should we test, if default_output_format is not defined?
# For now we test everything ...
set(out_formats "xhtml" ${DVI_FORMATS} ${PDF_FORMATS})
- foreach(_l ${lines})
+ foreach(_l IN LISTS lines)
if(_l MATCHES "^\\\\default_output_format +\([^ ]+\)")
set(_format ${CMAKE_MATCH_1})
if(_format STREQUAL "default")
More information about the lyx-cvs
mailing list