Re: [cmake-developers] Generating guards around add_library(... IMPORTED)

2012-12-19 Thread Stephen Kelly
Alexander Neundorf wrote: The point is that you get targets from one installed Config.cmake file, and other information from a different installed Config.cmake file, due to different required version or search paths. Should we guard the whole Config.cmake file ? A Config file author

Re: [cmake-developers] Generating guards around add_library(... IMPORTED)

2012-12-18 Thread Stephen Kelly
Alexander Neundorf wrote: With the return() in the FooTargets.cmake file, this included file will simply do nothing, and we'll stay with the old imported targets and their properties. But the FooConfig.cmake file which has just been executed may set a bunch of variables, which would fit to

Re: [cmake-developers] Generating guards around add_library(... IMPORTED)

2012-12-18 Thread Alexander Neundorf
On Tuesday 18 December 2012, Stephen Kelly wrote: Alexander Neundorf wrote: With the return() in the FooTargets.cmake file, this included file will simply do nothing, and we'll stay with the old imported targets and their properties. But the FooConfig.cmake file which has just been

Re: [cmake-developers] Generating guards around add_library(... IMPORTED)

2012-12-18 Thread Stephen Kelly
Alexander Neundorf wrote: On Tuesday 18 December 2012, Stephen Kelly wrote: Alexander Neundorf wrote: With the return() in the FooTargets.cmake file, this included file will simply do nothing, and we'll stay with the old imported targets and their properties. But the FooConfig.cmake

Re: [cmake-developers] Generating guards around add_library(... IMPORTED)

2012-12-16 Thread Alexander Neundorf
On Friday 30 November 2012, Stephen Kelly wrote: Brad King wrote: On 11/29/2012 02:22 PM, David Cole wrote: But with the multiple OR technique, if there is a single target name clash, NONE of the targets will be included properly Good catch. I read it as AND, which it should be:

Re: [cmake-developers] Generating guards around add_library(... IMPORTED)

2012-11-30 Thread Stephen Kelly
Brad King wrote: On 11/29/2012 02:22 PM, David Cole wrote: But with the multiple OR technique, if there is a single target name clash, NONE of the targets will be included properly Good catch. I read it as AND, which it should be: if(TARGET a AND TARGET b AND ...) return()

[cmake-developers] Generating guards around add_library(... IMPORTED)

2012-11-29 Thread Stephen Kelly
Hi there, This subject came up before and I would like to revisit it: http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/2147/focus=2151 The problem is that authors of Config files are currently required to guard their include(MyPackageTargets.cmake) line manually. This is

Re: [cmake-developers] Generating guards around add_library(... IMPORTED)

2012-11-29 Thread Brad King
On 11/29/2012 12:29 PM, Stephen Kelly wrote: Really I think the most practical solution is to generate 'if (NOT TARGET)' Defining the targets is not the only thing that a targets file does. It also sets all the properties. How will you guard those? They do not always appear next to the

Re: [cmake-developers] Generating guards around add_library(... IMPORTED)

2012-11-29 Thread Stephen Kelly
Brad King wrote: On 11/29/2012 12:29 PM, Stephen Kelly wrote: Really I think the most practical solution is to generate 'if (NOT TARGET)' Defining the targets is not the only thing that a targets file does. It also sets all the properties. How will you guard those? They do not always

Re: [cmake-developers] Generating guards around add_library(... IMPORTED)

2012-11-29 Thread Brad King
On 11/29/2012 01:44 PM, Stephen Kelly wrote: 1) and 2) imply for me that we can wrap the entire snippet I pasted above in if (NOT TARGET grantlee_core). Okay with me. You could also do if(NOT TARGET a AND NOT TARGET b AND ...) for all of the targets. Then there would be almost no chance

Re: [cmake-developers] Generating guards around add_library(... IMPORTED)

2012-11-29 Thread Stephen Kelly
Brad King wrote: On 11/29/2012 01:44 PM, Stephen Kelly wrote: 1) and 2) imply for me that we can wrap the entire snippet I pasted above in if (NOT TARGET grantlee_core). Okay with me. You could also do if(NOT TARGET a AND NOT TARGET b AND ...) for all of the targets. Then there

Re: [cmake-developers] Generating guards around add_library(... IMPORTED)

2012-11-29 Thread Brad King
On 11/29/2012 02:12 PM, Stephen Kelly wrote: Rather than reindenting everything, can I do this instead? if(TARGET a OR TARGET b OR ...) return() endif() Yes. That will be much cleaner too. Please also generate a comment that explains the motivation. Thanks, -Brad -- Powered by

Re: [cmake-developers] Generating guards around add_library(... IMPORTED)

2012-11-29 Thread David Cole
But with the multiple OR technique, if there is a single target name clash, NONE of the targets will be included properly, and quite likely, very mysteriously... I don't know about the rest of you, but I hate mysterious (and silent) errors. On Thu, Nov 29, 2012 at 2:18 PM, Brad King

Re: [cmake-developers] Generating guards around add_library(... IMPORTED)

2012-11-29 Thread Brad King
On 11/29/2012 02:22 PM, David Cole wrote: But with the multiple OR technique, if there is a single target name clash, NONE of the targets will be included properly Good catch. I read it as AND, which it should be: if(TARGET a AND TARGET b AND ...) return() endif() -Brad -- Powered