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

Alexander Neundorf neundorf at kde.org
Mon Sep 17 15:14:34 EDT 2012


On Monday 17 September 2012, Brad King wrote:
> On 09/15/2012 04:45 PM, Alexander Neundorf wrote:
> > There is now a branch export-sets-2 on cmake stage.
> > It cherry-picks a lot of the patches from
> > http://gitorious.org/~urkud1/cmake/urkud-cmake/commits/w/export-set,
> > mostly those from May, and then proceeds a bit differently.
> > 
> > In the end, cmake now checks whether a target which is missing in the
> > current export set has been exported and installed exactly once, gets
> > the correct name from that one installation (i.e. the used namespace),
> > and uses that.
> 
> That simple approach will allow us to move forward with this.  If anyone
> wants multiple exports of the same targets then they can add the explicit
> export set DEPENDS options later.

Cool.
The tests are not yet passing, I'll work on this.
 
> The topic looks good except for the details below.
> 
> > Additionally it puts the following check in the generated target file:
> > 
> > IF(NOT TARGET "Foo::foo" )
> > 
> >   MESSAGE(FATAL_ERROR "Required imported target \"Foo::foo\" not found !
> >   ")
> > 
> > ENDIF()
> > 
> > Please review the branch.
> > Exotic cases are not supported, but it should be possible now to export
> > libraries in separate export sets and still have it work.
> > 
> > I guess I have to handle the error case better than simply erroring out.
> 
> Not IMO.  Remember my message here:
> 
>  http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/4374/focu
> s=4386
> 
> The user has the option to specify a known-working <pkg>_DIR value or
> disable use of the package completely.  Your commit message sentence
> "I guess instead of completely erroring out it would be better to only
> make the find_package() fail." is not needed.


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.
If the package is optional, this is ok, cmake should not abort, but just 
report that the package was not found.

In the referenced email, if the error occurs, something is broken on the 
system, a broken package has been installed, or something like that. This is 
IMO different than simply a missing package.

Alex



More information about the cmake-developers mailing list