Re: [CMake] Generator expressions containing spaces

2018-04-24 Thread Elvis Stansvik
2018-04-24 21:37 GMT+02:00 Yves Frederix : > There is no real need to go through an intermediate variable. The following > should work: > > add_compile_options( >"$<$:-Wall;-Wextra;-Werror>" > ) Ah, of course. Thanks. Elvis > > Yves > > > On Tue, Apr 24, 2018 at 6:58 PM, Elvis Stansvik > wr

Re: [CMake] Generator expressions containing spaces

2018-04-24 Thread Yves Frederix
There is no real need to go through an intermediate variable. The following should work: add_compile_options( "$<$:-Wall;-Wextra;-Werror>" ) Yves On Tue, Apr 24, 2018 at 6:58 PM, Elvis Stansvik < elvis.stans...@orexplore.com> wrote: > 2018-04-23 14:11 GMT+02:00 CHEVRIER, Marc : > > The spac

Re: [CMake] Generator expressions containing spaces

2018-04-24 Thread Elvis Stansvik
2018-04-24 18:58 GMT+02:00 Elvis Stansvik : > 2018-04-23 14:11 GMT+02:00 CHEVRIER, Marc : >> The space is used to separate arguments passed to COMMAND. So your generator >> expression is splitted before evaluation and elements are no longer valid >> generator expression. >> >> >> >> So, to solve yo

Re: [CMake] Generator expressions containing spaces

2018-04-24 Thread Elvis Stansvik
2018-04-23 14:11 GMT+02:00 CHEVRIER, Marc : > The space is used to separate arguments passed to COMMAND. So your generator > expression is splitted before evaluation and elements are no longer valid > generator expression. > > > > So, to solve your problem, encapsulate the generator expression insi

Re: [CMake] Generator expressions containing spaces

2018-04-23 Thread Yves Frederix
It seems COMMAND_EXPAND_LISTS was indeed the key here. Thanks a lot! Yves On Mon, Apr 23, 2018 at 2:11 PM, CHEVRIER, Marc wrote: > The space is used to separate arguments passed to COMMAND. So your > generator expression is splitted before evaluation and elements are no > longer valid generator

Re: [CMake] Generator expressions containing spaces

2018-04-23 Thread CHEVRIER, Marc
The space is used to separate arguments passed to COMMAND. So your generator expression is splitted before evaluation and elements are no longer valid generator expression. So, to solve your problem, encapsulate the generator expression inside quotes. And apply the following advices for correct

Re: [CMake] Generator Expressions and FetchContent

2018-03-19 Thread Saad Khattak
I do use target_link_libraries when it comes to C++ projects and it works wonderfully for them. However, in this case, my base project has a bunch of helper files with CMake functionality that help me work with and build my library of projects (which you can see here https://github.com/2LoC/tl_base

Re: [CMake] Generator Expressions and FetchContent

2018-03-19 Thread Craig Scott
On Mon, Mar 19, 2018 at 8:25 AM, Saad Khattak wrote: > Thank you for the clarification Craig. > > >> If you made your main target link against LibA, you'd see that CMake > automatically expands out the generator expressions when it constructs the > link command line for main, so the example as it

Re: [CMake] Generator Expressions and FetchContent

2018-03-18 Thread Saad Khattak
Thank you for the clarification Craig. >> If you made your main target link against LibA, you'd see that CMake automatically expands out the generator expressions when it constructs the link command line for main, so the example as it stands doesn't actually have any error. In my actual project,

Re: [CMake] Generator Expressions and FetchContent

2018-03-18 Thread Craig Scott
On Mon, Mar 19, 2018 at 3:44 AM, Saad Khattak wrote: > Absolutely. Please find the example project here: https://github.com/ > samaursa/cmake_fetch_content_and_generator_expressions > > The repository README also includes the output from running `./setup.sh`. > Okay that's much clearer, thanks.

Re: [CMake] Generator Expressions and FetchContent

2018-03-18 Thread Saad Khattak
Absolutely. Please find the example project here: https://github.com/samaursa/cmake_fetch_content_and_generator_expressions The repository README also includes the output from running `./setup.sh`. On Sat, Mar 17, 2018 at 6:47 PM Craig Scott wrote: > Can you provide a small project example that

Re: [CMake] Generator Expressions and FetchContent

2018-03-17 Thread Craig Scott
Can you provide a small project example that can be used to demonstrate your problem? The specifics of how you are doing things may be important. On Sun, Mar 18, 2018 at 8:12 AM, Saad Khattak wrote: > Hi, > > ExternalProject_Add builds, generates and installs and thus any generator > expression

Re: [CMake] Generator expressions: Identifying when they're used in a custom command?

2018-02-19 Thread Alan W. Irwin
On 2018-02-19 13:03-0700 Sam Edwards wrote: Alan, I'm kicking myself for leaving off the DEPENDS in add_custom_target as that is the most essential part of what you suggested. Bah! I tried copying in your changes verbatim and I'm still left with an output that produces IS_INTERROGATE=0. This i

Re: [CMake] Generator expressions: Identifying when they're used in a custom command?

2018-02-19 Thread Elvis Stansvik
2018-02-19 21:03 GMT+01:00 Sam Edwards : > Alan, > > I'm kicking myself for leaving off the DEPENDS in add_custom_target as that > is the most essential part of what you suggested. Bah! > > I tried copying in your changes verbatim and I'm still left with an output > that produces IS_INTERROGATE=0.

Re: [CMake] Generator expressions: Identifying when they're used in a custom command?

2018-02-19 Thread Sam Edwards
Alan, I'm kicking myself for leaving off the DEPENDS in add_custom_target as that is the most essential part of what you suggested. Bah! I tried copying in your changes verbatim and I'm still left with an output that produces IS_INTERROGATE=0. This is on both 3.9.6 (my development machine) and 2.

Re: [CMake] Generator expressions: Identifying when they're used in a custom command?

2018-02-19 Thread Alan W. Irwin
On 2018-02-18 19:47-0700 Sam Edwards wrote: Alan, Thanks for your help! I tried to implement that paradigm myself in a small example CMakeLists.txt which I've attached, but the addition of a depending custom target doesn't seem to change the context of the 'this' target. In other words, the IS_

Re: [CMake] Generator expressions: Identifying when they're used in a custom command?

2018-02-18 Thread Sam Edwards
Alan, Thanks for your help! I tried to implement that paradigm myself in a small example CMakeLists.txt which I've attached, but the addition of a depending custom target doesn't seem to change the context of the 'this' target. In other words, the IS_INTERROGATE property is still read from fake_ta

Re: [CMake] Generator expressions: Identifying when they're used in a custom command?

2018-02-18 Thread Alan W. Irwin
On 2018-02-18 03:49-0700 Sam Edwards wrote: However, when it came time to actually set this IS_INTERROGATE property, I could find no way to apply it to a custom command. I guess this makes sense - custom commands aren't targets, after all. But I couldn't convert my custom command to a custom tar

Re: [CMake] generator expressions

2015-04-08 Thread Robert Maynard
Hi Micha, When using generator expressions inside target_include_directories you must qualify all paths. Either by using absolute paths, or using one of the helper variables that allows CMake to determine where the relative path should be evaluated from. This is all really well documented at: htt

Re: [CMake] generator-expressions + pch -> need new magic

2014-10-05 Thread Evgeniy Dushistov
I found workaround for that problem, I add to this loop: foreach(flag ${MY_DEFS}) list(APPEND gcc_flags "-D${flag}") endforeach() such code: foreach(flag ${PL_COMP_DEFS}) string(FIND ${flag} "$<" find_res) if (find_res EQUAL 0) list(APPEND gcc_flags "$<$:-D$>") else ()

Re: [CMake] generator expressions

2014-06-06 Thread Andrew Fuller
On Fri, Jun 6, 2014 at 8:43 AM, Brad King wrote: > On 06/06/2014 11:37 AM, Andrew Fuller wrote: > > Should I be quoting all my generator expressions? > > Is that the proper syntax? > > The CMake language does not actually know anything about generator > expressions. They are just strings like an

Re: [CMake] generator expressions

2014-06-06 Thread Brad King
On 06/06/2014 11:37 AM, Andrew Fuller wrote: > Should I be quoting all my generator expressions? > Is that the proper syntax? The CMake language does not actually know anything about generator expressions. They are just strings like any other command arguments as far as it knows. See the command

Re: [CMake] generator expressions

2014-06-06 Thread Andrew Fuller
On Fri, Jun 6, 2014 at 8:28 AM, Brad King wrote: > On 06/06/2014 11:07 AM, Andrew Fuller wrote: > > On Fri, Jun 6, 2014 at 6:08 AM, Brad King > wrote: > > > > I cannot reproduce these. Can you provide a complete CMakeLists.txt > > example please? > > > > At

Re: [CMake] generator expressions

2014-06-06 Thread Brad King
On 06/06/2014 11:07 AM, Andrew Fuller wrote: > On Fri, Jun 6, 2014 at 6:08 AM, Brad King > wrote: > > I cannot reproduce these. Can you provide a complete CMakeLists.txt > example please? > > Attached Thanks. I meant to quote the whole outermost $<> expr

Re: [CMake] generator expressions

2014-06-06 Thread Brad King
On 06/05/2014 04:44 PM, Andrew Fuller wrote: > target_link_libraries( my_target PRIVATE > $<$:win.1;win.2> > $<$:lin.1;lin.2> ) > gives a link line of -lwin.2 -llin.1 -llin.2 [snip] > $<$:$> [snip] > It appears in this instance as though the list is being split before > the

Re: [CMake] Generator expressions in custom commands

2010-09-06 Thread Michael Wild
On 6. Sep, 2010, at 20:58 , David Cole wrote: > On Mon, Sep 6, 2010 at 2:34 PM, Michael Wild wrote: > >> Hi all >> >> add_test(NAME COMMAND ) has these cool generator >> expressions, where one can use e.g $ to obtain the file >> name of the target. I wondered whether there was a reason as to

Re: [CMake] Generator expressions in custom commands

2010-09-06 Thread David Cole
On Mon, Sep 6, 2010 at 2:34 PM, Michael Wild wrote: > Hi all > > add_test(NAME COMMAND ) has these cool generator > expressions, where one can use e.g $ to obtain the file > name of the target. I wondered whether there was a reason as to why this > feature isn't available in custom commands, esp