Spaces in conditional output of generator expressions

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

Spaces in conditional output of generator expressions

Neil Carlson
I'm attempting to use a generator expression to conditionally add compile options. No problem if it is a single option, but I can't figure out how to manage multiple options (in a single command). 

For example, this works:
add_compile_options($<$<COMPILE_LANGUAGE:C>-Wall>)

As does this:
add_compile_options(-Wall -Wextra)

But not this:
add_compile_options($<$<COMPILE_LANGUAGE:C>-Wall -Wextra>)

Nor this:
add_compile_options($<$<COMPILE_LANGUAGE:C>"-Wall -Wextra">)

Or any other variation I could think of.  Either the space breaks the generator expression, or I get a quoted version of the options that the compiler sees as a single "option" it doesn't understand.

Is there some way of doing this?

PS: I'm trying to avoid using CMAKE_C_FLAGS. My understanding is that variable is meant for the end user's use.  Am I mistaken about that?


--

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
Reply | Threaded
Open this post in threaded view
|

Re: Spaces in conditional output of generator expressions

Stephen McDowell
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.

-Stephen


On Sat, Jun 2, 2018, 3:47 PM Neil Carlson <[hidden email]> wrote:
I'm attempting to use a generator expression to conditionally add compile options. No problem if it is a single option, but I can't figure out how to manage multiple options (in a single command). 

For example, this works:
add_compile_options($<$<COMPILE_LANGUAGE:C>-Wall>)

As does this:
add_compile_options(-Wall -Wextra)

But not this:
add_compile_options($<$<COMPILE_LANGUAGE:C>-Wall -Wextra>)

Nor this:
add_compile_options($<$<COMPILE_LANGUAGE:C>"-Wall -Wextra">)

Or any other variation I could think of.  Either the space breaks the generator expression, or I get a quoted version of the options that the compiler sees as a single "option" it doesn't understand.

Is there some way of doing this?

PS: I'm trying to avoid using CMAKE_C_FLAGS. My understanding is that variable is meant for the end user's use.  Am I mistaken about that?

--

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

--

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
Reply | Threaded
Open this post in threaded view
|

Re: Spaces in conditional output of generator expressions

Neil Carlson
On Sat, Jun 2, 2018 at 4:53 PM Stephen McDowell <[hidden email]> 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.

--

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
Reply | Threaded
Open this post in threaded view
|

Re: Spaces in conditional output of generator expressions

Craig Scott-3


On Sun, Jun 3, 2018 at 12:34 PM, Neil Carlson <[hidden email]> wrote:
On Sat, Jun 2, 2018 at 4:53 PM Stephen McDowell <[hidden email]> 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

--

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
Reply | Threaded
Open this post in threaded view
|

Re: Spaces in conditional output of generator expressions

Marc CHEVRIER
Did you try with $<SEMICOLON> rather than the ; character?

Le dim. 3 juin 2018 à 06:24, Craig Scott <[hidden email]> a écrit :
On Sun, Jun 3, 2018 at 12:34 PM, Neil Carlson <[hidden email]> wrote:
On Sat, Jun 2, 2018 at 4:53 PM Stephen McDowell <[hidden email]> 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
--

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

--

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
Reply | Threaded
Open this post in threaded view
|

Re: Spaces in conditional output of generator expressions

Neil Carlson
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 <[hidden email]> wrote:
Did you try with $<SEMICOLON> rather than the ; character?

Le dim. 3 juin 2018 à 06:24, Craig Scott <[hidden email]> a écrit :
On Sun, Jun 3, 2018 at 12:34 PM, Neil Carlson <[hidden email]> wrote:
On Sat, Jun 2, 2018 at 4:53 PM Stephen McDowell <[hidden email]> 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
--

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

--

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
Reply | Threaded
Open this post in threaded view
|

Re: Spaces in conditional output of generator expressions

Marc CHEVRIER
When you use bare semicolon, it is required to encapsulate the whole generator expression in quotes to avoid list evaluation during command call;

i.e:
WRONG: target_compile_options(someTarget PRIVATE $<$<COMPILE_LANGUAGE:CXX>:-Wall;-Wextra>)
GOOD: target_compile_options(someTarget PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:-Wall;-Wextra>")


Le dim. 3 juin 2018 à 15:03, Neil Carlson <[hidden email]> a écrit :
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 <[hidden email]> wrote:
Did you try with $<SEMICOLON> rather than the ; character?

Le dim. 3 juin 2018 à 06:24, Craig Scott <[hidden email]> a écrit :
On Sun, Jun 3, 2018 at 12:34 PM, Neil Carlson <[hidden email]> wrote:
On Sat, Jun 2, 2018 at 4:53 PM Stephen McDowell <[hidden email]> 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
--

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

--

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
Reply | Threaded
Open this post in threaded view
|

Re: Spaces in conditional output of generator expressions

Neil Carlson

On Sun, Jun 3, 2018 at 7:08 AM Marc CHEVRIER <[hidden email]> wrote:
[...]
GOOD: target_compile_options(someTarget PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:-Wall;-Wextra>")

Ah, that's it. Never occurred to me to quote the whole thing, thinking that would turn the generator expression into a literal string and not be interpreted.  Thanks! 

 

--

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
Reply | Threaded
Open this post in threaded view
|

Re: Spaces in conditional output of generator expressions

Neil Carlson
Something not immediately obvious to me, and perhaps not to others that might come across this thread, is that all spaces in the option string need to be replaced with a semicolon, and not just those that separate options (with Linux/make at least). For example  an option that takes an argument '-assume realloc_lhs'. If you do this:

BAD: add_compile_options("$<$<COMPILE_LANGUAGE:Fortran>:-assume realloc_lhs>")

you get a single quoted token "-assume realloc_lhs" on the compile line which the compiler doesn't understand. The correct thing is

GOOD: add_compile_options("$<$<COMPILE_LANGUAGE:Fortran>:-assume;realloc_lhs>")


On Sun, Jun 3, 2018 at 7:33 AM Neil Carlson <[hidden email]> wrote:

On Sun, Jun 3, 2018 at 7:08 AM Marc CHEVRIER <[hidden email]> wrote:
[...]
GOOD: target_compile_options(someTarget PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:-Wall;-Wextra>")

Ah, that's it. Never occurred to me to quote the whole thing, thinking that would turn the generator expression into a literal string and not be interpreted.  Thanks! 

 

--

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
Reply | Threaded
Open this post in threaded view
|

Re: Spaces in conditional output of generator expressions

Marc CHEVRIER
In fact, the right way to manage « composite » options is to use « SHELL: » prefix (introduced in up-coming version 3.12).


Le dim. 3 juin 2018 à 16:11, Neil Carlson <[hidden email]> a écrit :
Something not immediately obvious to me, and perhaps not to others that might come across this thread, is that all spaces in the option string need to be replaced with a semicolon, and not just those that separate options (with Linux/make at least). For example  an option that takes an argument '-assume realloc_lhs'. If you do this:

BAD: add_compile_options("$<$<COMPILE_LANGUAGE:Fortran>:-assume realloc_lhs>")

you get a single quoted token "-assume realloc_lhs" on the compile line which the compiler doesn't understand. The correct thing is

GOOD: add_compile_options("$<$<COMPILE_LANGUAGE:Fortran>:-assume;realloc_lhs>")


On Sun, Jun 3, 2018 at 7:33 AM Neil Carlson <[hidden email]> wrote:

On Sun, Jun 3, 2018 at 7:08 AM Marc CHEVRIER <[hidden email]> wrote:
[...]
GOOD: target_compile_options(someTarget PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:-Wall;-Wextra>")

Ah, that's it. Never occurred to me to quote the whole thing, thinking that would turn the generator expression into a literal string and not be interpreted.  Thanks! 

 
--

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

--

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
Reply | Threaded
Open this post in threaded view
|

Re: Spaces in conditional output of generator expressions

Hendrik Sattler


Am 3. Juni 2018 16:33:12 MESZ schrieb Marc CHEVRIER <[hidden email]>:
>In fact, the right way to manage « composite » options is to use «
>SHELL: »
>prefix (introduced in up-coming version 3.12).

Can you modify the example to show its use?
Why is it called shell? IMHO a build to its not required to use any kind of shell.

>Le dim. 3 juin 2018 à 16:11, Neil Carlson <[hidden email]> a
>écrit :
>
>> Something not immediately obvious to me, and perhaps not to others
>that
>> might come across this thread, is that all spaces in the option
>string need
>> to be replaced with a semicolon, and not just those that separate
>options
>> (with Linux/make at least). For example  an option that takes an
>argument
>> '-assume realloc_lhs'. If you do this:
>>
>> BAD: add_compile_options("$<$<COMPILE_LANGUAGE:Fortran>:-assume
>> realloc_lhs>")
>>
>> you get a single quoted token "-assume realloc_lhs" on the compile
>line
>> which the compiler doesn't understand. The correct thing is
>>
>>
>> GOOD:
>add_compile_options("$<$<COMPILE_LANGUAGE:Fortran>:-assume;realloc_lhs>")
>>
>>
>> On Sun, Jun 3, 2018 at 7:33 AM Neil Carlson
><[hidden email]>
>> wrote:
>>
>>>
>>> On Sun, Jun 3, 2018 at 7:08 AM Marc CHEVRIER
><[hidden email]>
>>> wrote:
>>>
>>>> [...]
>>>> GOOD: target_compile_options(someTarget PRIVATE
>>>>  "$<$<COMPILE_LANGUAGE:CXX>:-Wall;-Wextra>")
>>>>
>>>
>>> Ah, that's it. Never occurred to me to quote the whole thing,
>thinking
>>> that would turn the generator expression into a literal string and
>not be
>>> interpreted.  Thanks!
>>>
>>>
>>>
>> --
>>
>> 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
>>
--

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
Reply | Threaded
Open this post in threaded view
|

Re: Spaces in conditional output of generator expressions

Marc CHEVRIER

Using "SHELL:": add_compile_options("$<$<COMPILE_LANGUAGE:Fortran>:SHELL:-assume realloc_lhs>")  
By using "SHELL:", you ensure that the two parts of the option will be remain together.



Le dim. 3 juin 2018 à 18:40, Hendrik Sattler <[hidden email]> a écrit :


Am 3. Juni 2018 16:33:12 MESZ schrieb Marc CHEVRIER <[hidden email]>:
>In fact, the right way to manage « composite » options is to use «
>SHELL: »
>prefix (introduced in up-coming version 3.12).

Can you modify the example to show its use?
Why is it called shell? IMHO a build to its not required to use any kind of shell.

>Le dim. 3 juin 2018 à 16:11, Neil Carlson <[hidden email]> a
>écrit :
>
>> Something not immediately obvious to me, and perhaps not to others
>that
>> might come across this thread, is that all spaces in the option
>string need
>> to be replaced with a semicolon, and not just those that separate
>options
>> (with Linux/make at least). For example  an option that takes an
>argument
>> '-assume realloc_lhs'. If you do this:
>>
>> BAD: add_compile_options("$<$<COMPILE_LANGUAGE:Fortran>:-assume
>> realloc_lhs>")
>>
>> you get a single quoted token "-assume realloc_lhs" on the compile
>line
>> which the compiler doesn't understand. The correct thing is
>>
>>
>> GOOD:
>add_compile_options("$<$<COMPILE_LANGUAGE:Fortran>:-assume;realloc_lhs>")
>>
>>
>> On Sun, Jun 3, 2018 at 7:33 AM Neil Carlson
><[hidden email]>
>> wrote:
>>
>>>
>>> On Sun, Jun 3, 2018 at 7:08 AM Marc CHEVRIER
><[hidden email]>
>>> wrote:
>>>
>>>> [...]
>>>> GOOD: target_compile_options(someTarget PRIVATE
>>>>  "$<$<COMPILE_LANGUAGE:CXX>:-Wall;-Wextra>")
>>>>
>>>
>>> Ah, that's it. Never occurred to me to quote the whole thing,
>thinking
>>> that would turn the generator expression into a literal string and
>not be
>>> interpreted.  Thanks!
>>>
>>>
>>>
>> --
>>
>> 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
>>

--

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