[CMake] LIST does not respect slash-qoted seminolons

Svami Dhyan Nataraj n at shaplov.ru
Sat Feb 21 15:03:50 EST 2009


LIST does not respect slash-qoted seminolons:

When I read the file via FILE(STRINGS, all semicolons that were in file
are quoted(or masked do not know right word) by backslash...
but LIST operator does not respect it.

for example:

cmake_policy(SET CMP0007 NEW) # do not ignore empty list item in list
command SET(text "1;;2\;2;;;;3;4;")
SET(text "dummy_line;${text}")

MESSAGE(STATUS "=== FOREACH ===")
FOREACH(str ${text})
  MESSAGE(STATUS "${str}")
ENDFOREACH(str)

MESSAGE(STATUS "=== WHILE + LIST ===")

WHILE(NOT text STREQUAL "dummy_line" )
  list(GET text 1 str)
  list(REMOVE_AT text 1)
  MESSAGE(STATUS "-${str}-").
ENDWHILE(NOT text STREQUAL "dummy_line" )

we will get as output:

-- === FOREACH ===
-- dummy_line
-- 1
-- 2;2
-- 3
-- 4
-- === WHILE + LIST ===
-- -1-
-- --
-- -2-
-- -2-
-- --
-- --
-- --
-- -3-
-- -4-
-- --

here we can see that all though foreach skips empty list elements, it
respect quoted semicolon. LIST can handle emply elements, but treat
quoted semicolon as a list separator.

Is this a bug? Is this bug is known? should I add it to bug tracker?


More information about the CMake mailing list