Re: [CMake] Spaces in conditional output of generator expressions

2018-06-03 Thread Marc CHEVRIER
Using "SHELL:": add_compile_options("$<$:SHELL:-assume realloc_lhs>") By using "SHELL:", you ensure that the two parts of the option will be remain together. Documentation is here: https://cmake.org/cmake/help/git-master/command/target_compile_options.html Le dim. 3 juin 2018 à 18:40, Hendrik Sa

Re: [CMake] Spaces in conditional output of generator expressions

2018-06-03 Thread Hendrik Sattler
Am 3. Juni 2018 16:33:12 MESZ schrieb Marc CHEVRIER : >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

Re: [CMake] Spaces in conditional output of generator expressions

2018-06-03 Thread 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 a écrit : > Something not immediately obvious to me, and perhaps not to others that > might come across this thread, is that all s

Re: [CMake] Spaces in conditional output of generator expressions

2018-06-03 Thread 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 '-a

Re: [CMake] Spaces in conditional output of generator expressions

2018-06-03 Thread Neil Carlson
On Sun, Jun 3, 2018 at 7:08 AM Marc CHEVRIER wrote: > [...] > GOOD: target_compile_options(someTarget PRIVATE > "$<$:-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.

Re: [CMake] Spaces in conditional output of generator expressions

2018-06-03 Thread 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 $<$:- Wall;-Wextra>) GOOD: target_compile_options(someTarget PRIVATE "$<$:- Wall;-Wextra>") Le d

Re: [CMake] Spaces in conditional output of generator expressions

2018-06-03 Thread 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 $ 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 wrote:

Re: [CMake] Spaces in conditional output of generator expressions

2018-06-02 Thread Marc CHEVRIER
Did you try with $ rather than the ; character? Le dim. 3 juin 2018 à 06:24, Craig Scott a écrit : > On Sun, Jun 3, 2018 at 12:34 PM, Neil Carlson > wrote: > >> On Sat, Jun 2, 2018 at 4:53 PM Stephen McDowell >> wrote: >> >>> It should be a CMake list, which is delineated by semicolons. >>> >>

Re: [CMake] Spaces in conditional output of generator expressions

2018-06-02 Thread Craig Scott
On Sun, Jun 3, 2018 at 12:34 PM, Neil Carlson wrote: > On Sat, Jun 2, 2018 at 4:53 PM Stephen McDowell > wrote: > >> It should be a CMake list, which is delineated by semicolons. >> >> add_compile_options($<$-Wall;-Wextra>) >> >> I am writing this from a phone so untested, but that has worked fo

Re: [CMake] Spaces in conditional output of generator expressions

2018-06-02 Thread Neil Carlson
On Sat, Jun 2, 2018 at 4:53 PM Stephen McDowell wrote: > It should be a CMake list, which is delineated by semicolons. > > add_compile_options($<$-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 th

Re: [CMake] Spaces in conditional output of generator expressions

2018-06-02 Thread Stephen McDowell
It should be a CMake list, which is delineated by semicolons. add_compile_options($<$-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 wrote: > I'm attempting to use a generator expression to

[CMake] Spaces in conditional output of generator expressions

2018-06-02 Thread 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($<$-Wall>) As does this: add_compile_options(-Wall -Wex