[CMake] avoid substitution of semicolon

David Cole david.cole at kitware.com
Tue Mar 15 12:34:40 EDT 2011


What are you going to do with it once it's in the value ARCH or x?

It's hard to see the literal contents of a cmake variable without
using "" in the message command.

This code:
set(x "-DCMAKE_OSX_ARCHITECTURES=i386\\;x86_64")
message("${x}")

produces this output:
-DCMAKE_OSX_ARCHITECTURES=i386\;x86_64

The "\" needs escaping, and needs to be doubled up in the set call.
The arg to message needs to be quoted so that semi-colons do not get
eaten.

Does that help?

If not, we need more context......


Cheers,
David


On Tue, Mar 15, 2011 at 12:25 PM, Tim Blechmann <tim at klingt.org> wrote:
> hi all,
>
> i am trying to write a ctest script, compiling for different OSX architectures.
> the CMAKE_OSX_ARCHITECTURES option uses the semicolon to distinguish between
> architectures, but my attempts to generate the argument string with semicolons
> haven't been successful, it seems they are not escaped:
>
> foreach(ARCH ppc i386 x86_64 "ppc\;i386" "i386\;x86_64" "ppc\;i386\;x86_64")
>  set(x -DCMAKE_OSX_ARCHITECTURES=${ARCH})
>  message (${x})
> endforeach()
>
> gives me:
> -DCMAKE_OSX_ARCHITECTURES=ppc
> -DCMAKE_OSX_ARCHITECTURES=i386
> -DCMAKE_OSX_ARCHITECTURES=x86_64
> -DCMAKE_OSX_ARCHITECTURES=ppci386
> -DCMAKE_OSX_ARCHITECTURES=i386x86_64
> -DCMAKE_OSX_ARCHITECTURES=ppci386x86_64
>
> any idea how i could create the correct argument string?
>
> thanks, tim
>
> --
> tim at klingt.org
> http://tim.klingt.org
>
> /"\  ASCII Ribbon Campaign
> \ /   no HTML in email & vCards
>  X     no proprietary attachments
> / \     use open standards
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>


More information about the CMake mailing list