[CMake] Spaces in conditional output of generator expressions

Neil Carlson neil.n.carlson at gmail.com
Sun Jun 3 09:03:35 EDT 2018


Sorry, the missing colon was a typo in my email, not actually missing.
Strangely, the bare semicolon doesn't work for me (Linux/make). However
$<SEMICOLON> does work!  That prompted me to try escaping the semicolon
(\;) and that worked too.  Thanks all!

On Sun, Jun 3, 2018 at 12:18 AM Marc CHEVRIER <marc.chevrier at gmail.com>
wrote:

> Did you try with $<SEMICOLON> rather than the ; character?
>
> Le dim. 3 juin 2018 à 06:24, Craig Scott <craig.scott at crascit.com> a
> écrit :
>
>> On Sun, Jun 3, 2018 at 12:34 PM, Neil Carlson <neil.n.carlson at gmail.com>
>> wrote:
>>
>>> On Sat, Jun 2, 2018 at 4:53 PM Stephen McDowell <sjm324 at cornell.edu>
>>> wrote:
>>>
>>>> It should be a CMake list, which is delineated by semicolons.
>>>>
>>>> add_compile_options($<$<COMPILE_LANGUAGE:C>-Wall;-Wextra>)
>>>>
>>>> I am writing this from a phone so untested, but that has worked for me
>>>> in the past.
>>>>
>>>
>>> Right about the list, and is one of the things I tried, but didn't work.
>>> This one
>>> seems to break the generator expression.
>>>
>>
>> I think you are missing a colon after the first ">". I just tried a
>> command like the following and it produces the right compiler command line
>> options for me (on macOS using CMake 3.11.0 with either Ninja or Xcode):
>>
>> target_compile_options(someTarget PRIVATE
>>     $<$<COMPILE_LANGUAGE:CXX>:-Wall;-Wextra>
>> )
>>
>> I also works for me even without the semi-colon (i.e. using a space
>> instead), which was kinda surprising given that I didn't quote the whole
>> generator expression. Not sure about other platforms or generators.
>>
>>
>>
>> --
>> Craig Scott
>> Melbourne, Australia
>> https://crascit.com
>> --
>>
>> 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:
>> https://cmake.org/mailman/listinfo/cmake
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20180603/e7df7f07/attachment.html>


More information about the CMake mailing list