Sorry, I meant to keep this on the mailing list.  Hit reply without
checking.

On Thu, Jun 5, 2014 at 1:33 PM, Andrew Fuller <mactalla.ob...@gmail.com>
wrote:

> A non-trivial overhaul of the graphviz option implementation will
>> be needed to make it useful on projects using modern features.
>>
>
> Okay, I understand.
>
> As I've continued to investigate this I think my issue is actually deeper.
>
> When setting compiler definitions I can set a list within a generator
> expression and the entire set is handled correctly.
>
> eg:
> target_compile_definitions( my_target PRIVATE
>  $<$<PLATFORM_ID:Windows>:winone;wintwo>
>  $<$<PLATFORM_ID:Linux>:linuxone;linuxtwo> )
> gives -Dlinuxone -Dlinuxtwo on the command line under Linux.
>
> However, trying to do the same with target_link_libraries yields different
> results:
> target_link_libraries( my_target PRIVATE
>  $<$<PLATFORM_ID:Windows>:win.1;win.2>
>  $<$<PLATFORM_ID:Linux>:lin.1;lin.2> )
> gives a link line of -lwin.2 -llin.1 -llin.2
>
> As I was experimenting I discovered that $<JOIN:...> provides an
> interesting perspective into the issue:
> target_link_libraries( my_target PRIVATE
>  $<$<PLATFORM_ID:Windows>:$<JOIN:win.1;win.2, -I>>
>  $<$<PLATFORM_ID:Linux>:lin.1;lin.2> )
> gives a link line of -llin.1 -llin.2
> $<JOIN...> seems to correctly group the list so the elements don't leak
> out of the generator expression.  At least when the condition evaluates to
> 0.
>
> However,
> target_link_libraries( my_target PRIVATE
>  $<$<PLATFORM_ID:Windows>:$<JOIN:win.1;win.2, -I>>
>  $<$<PLATFORM_ID:Linux>:$<JOIN:lin.1;lin.2, -l>> )
> Gives
> CMake Error:
>
>   Error evaluating generator expression:
>
>     $<JOIN:lin.1>
>
>   $<JOIN> expression requires 2 comma separated parameters, but got 1
>   instead.
>
> It appears in this instance as though the list is being split before the
> generator expression is being evaluated.  $<JOIN...> seems to function as
> expected when used in target_compile_definitions.
>
> Is there a limitation in target_link_libraries I should be aware of?  I
> didn't find anything obvious in the documentation.
> I should mention I'm running 3.0.0-rc3 and set cmake_policy( VERSION 3.0 ).
>
> Thanks,
> -Andrew
>
>
>
-- 

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

Reply via email to