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

Brad King brad.king at kitware.com
Mon Sep 17 08:50:46 EDT 2012


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.

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/focus=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.

Also, one of Yury's commit messages says:

 TODO: remove another clear() because it doesn't delete TargetExports.

What is that about?

Thanks,
-Brad



More information about the cmake-developers mailing list