[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cmake
Subject:    Re: [CMake] multi-line strings... is this expected?
From:       Matthew Woehlke <mw_triad () users ! sourceforge ! net>
Date:       2014-04-08 13:58:11
Message-ID: li0v9j$s6c$1 () ger ! gmane ! org
[Download RAW message or body]

On 2014-03-27 13:54, Matthew Woehlke wrote:
> I have ¹ a CTest like:
> 
> execute_process(...)
> set(expected "
> ...text...
> ...text...
> ")
> string(REGEX MATCH ${expected} match ${out})
> 
> 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...

For the record: no. It turns out the line endings is actually a) a red 
herring (although the problem was a platform difference in a way), and 
b) not actually an issue (on further investigation, both CMake 2.8.x and 
3.0 seem to be behaving as expected in this respect).

Can anyone spot the problem above? :-)


It turns out that what is *actually* happening is that this:

   string(REGEX MATCH ${expected} match ${out})

...strips any ';'s from ${out}. And incidentally, the work-around I was 
using ('string(REPLACE "\r" "" expected ${expected})') does likewise, so 
that the combination results in neither string containing ';'s, which 
then can match. I was only seeing issues on Windows because the relevant 
';'s are path separators, which are of course ':'s on other platforms 
and so are not affected.

Quoting the argument to REGEX MATCH is the actual correct fix :-).

-- 
Matthew

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: \
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information \
on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at \
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic