[CMake] JOIN generator expression not working

Petr Kmoch petr.kmoch at gmail.com
Fri Apr 17 05:21:14 EDT 2015


Hi Daniel.

Your generator expression contains a space (between "," and "-I"). Is it
quoted? Generator expressions are just normal strings until generate time,
and space normally separates CMake arguments. In other words, like this:

target_compile_options(trgt
-I$<JOIN:$<TARGET_PROPERTY:${LibraryName},INCLUDE_DIRECTORIES>, -I>)

the command has *two* arguments. One of them is specified as
"-I$<JOIN:$<TARGET_PROPERTY:${LibraryName},INCLUDE_DIRECTORIES>," and the
other as ", -I>". The TARGET_PROPERTY genex in the first one will be
expanded, but the string that's left is no a full genex, so it's left
verbatim.

In this, on the other hand:

target_compile_options(trgt
"-I$<JOIN:$<TARGET_PROPERTY:${LibraryName},INCLUDE_DIRECTORIES>, -I>")

the command has *one* argument. Both the inner and outer genex will then be
processed as expected.

Petr

On Fri, Apr 17, 2015 at 1:08 AM, Daniel Dilts <diltsman at gmail.com> wrote:

> I have this generator expression:
>
> -I$<JOIN:$<TARGET_PROPERTY:${LibraryName},INCLUDE_DIRECTORIES>, -I>
>
> I get this output in my custom command:
>
> -I$<JOIN:$ -I>
>
> This is almost exactly the same as the example in the documentation (other
> than adding ${LibraryName}).  Why doesn't this work?
>
> --
>
> 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://public.kitware.com/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150417/75a0cef3/attachment.html>


More information about the CMake mailing list