[CMake] generator expressions

Andrew Fuller mactalla.obair at gmail.com
Fri Jun 6 12:07:15 EDT 2014


On Fri, Jun 6, 2014 at 8:43 AM, Brad King <brad.king at kitware.com> wrote:

> On 06/06/2014 11:37 AM, Andrew Fuller wrote:
> > Should I be quoting all my generator expressions?
> > Is that the proper syntax?
>
> The CMake language does not actually know anything about generator
> expressions.  They are just strings like any other command arguments
> as far as it knows.  See the command argument syntax documentation
> here:
>
>
> http://www.cmake.org/cmake/help/v3.0/manual/cmake-language.7.html#command-arguments
>
> In order to ensure the command receives a generator expression in
> its entirety it should be double-quoted if it contains any literal
> spaces or ${var} evaluations that may have ; in them.  Otherwise
> it is not necessary to quote and sometimes looks nicer not to.  It
> is always safe to quote generator expressions though.
>
> -Brad
>
>
I agree it often looks better without the quotes.  But correctness trumps
aesthetics.  I guess where I went astray was that it appeared to work
unquoted when doing a simple test with add_executable and so I standardized
on unquoted which then came back to bite me unexpectedly later.  I think
I'm understanding better the situation thanks to your explanation combined
with that link.

I shall quote them all!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20140606/c20711c6/attachment.html>


More information about the CMake mailing list