[CMake] multi-line strings... is this expected?

Matthew Woehlke mw_triad at users.sourceforge.net
Thu Mar 27 13:54:04 EDT 2014


I have¹ a CTest like:

execute_process(...)
set(expected "
...text...
...text...
")
string(REGEX MATCH ${expected} match ${out})

So, basically, I'm checking that the process outputs a certain set of 
lines, and taking advantage of multi-line strings in CTest script for 
convenience and readability.

This works great... *IF* the script file has UNIX line endings. I'm 
wondering if that is expected? It seems that CTest must be processing 
the script in binary mode in order for the string to contain '\r' 
characters...

(I don't need the obvious work-around². I'm asking if this is expected 
and e.g. if I should file a bug report...)

I haven't tested exhaustively but this may not affect all versions of 
CMake. (Noticed on 2.8.11.1.)

(¹ 
https://github.com/commontk/AppLauncher/blob/master/Testing/CMake/AppLauncher-Settings-TestEnvironment.cmake)

(² 
https://github.com/mwoehlke-kitware/AppLauncher/tree/test-multi-line-string-fixes)

-- 
Matthew



More information about the CMake mailing list