> 
> It's up to users to use generator expressions instead of if(WIN32) or 
> whatever:
> 
> add_library(foo
>   foo.cpp
>   $<$<PLATFORM_ID:Windows>:foo_win.cpp>
> )
> 
> This has been possible for years and was designed with IDEs in mind:

Sure, it’s possible, but it’s not very user friendly or declarative (you need 
to parse and interpret the generator expression).

> 
> http://public.kitware.com/pipermail/cmake-developers/2014-September/023042.html
> 
>> I find that most of the conditionals are just to create the list of
>> sources per platform and then the list of dependencies. It’s certainly
>> possible to use generator expressions for some cases, but they don’t have
>> the prettiest syntax around, and maybe also not access to all the local
>> variables that you need to pick the right files.
> 
> You should be able to put any configure-time variable through the generator 
> expressions $<BOOL> or $<STREQUAL> to make them genex-compatible.

Same, it’s not user friendly or a great syntax.
I’ve rarely seen any advanced usage in projects in the wild, I think for that 
very reason.

One thing that I dislike in genex is that there is no “else” clause.
So you have to duplicate the whole condition and add a $<NOT> around it.
Having something close to a ternary operator would be nice.

/Florent
-- 

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-developers

Reply via email to