[cmake-developers] Exporting dependent library targets in multiple export sets

Alexander Neundorf neundorf at kde.org
Mon Sep 17 15:35:47 EDT 2012


On Monday 17 September 2012, Brad King wrote:
> On 09/17/2012 03:14 PM, Alexander Neundorf wrote:
> > On Monday 17 September 2012, Brad King wrote:
> >>> I guess I have to handle the error case better than simply erroring
> >>> out.
> >> 
> >> Not IMO.  Remember my message here:
> > I think this is different.
> > Here, in this case, it may fail because the required (missing) package
> > was simply not found, because it is not installed.
> 
> I must not understand the use case.  It looks to me like you're generating
> a <pkg>Targets.cmake file to be loaded by a <pkg>Config.cmake file.  If
> these files are being read then <pkg>_DIR is set to a copy of the <pkg>.
> The package has been found.  Just as in the previous discussion, the
> error in the package occurs because it is misconfigured: one of its
> dependencies is not installed or loaded correctly to provide the other
> imported target.

Let's say FooTargets.cmake provides the target foo.

BarTargets.cmake provides the target bar, and requires FooTargets.cmake.

Now if the user installed the bar-devel package, but not the foo-devel 
package, the target foo will not be available.
This can or should be checked also outside maybe in the BarConfig.cmake cmake, 
which could load BarTargets.cmake only if Foo could be found, but still I 
think it's not necessary to abort in this error case.

Alex



More information about the cmake-developers mailing list