[cmake-developers] Exporting dependent library targets in multiple export sets
Brad King
brad.king at kitware.com
Fri Sep 28 13:43:31 EDT 2012
On 09/28/2012 01:21 PM, Alexander Neundorf wrote:
> The imported target bld_testExe2lib in ExportBuildTree.cmake links against the
> imported target exp_testExe2libImp created in exp.cmake.
>
> So if exp.cmake is included after ExportBuildTree.cmake this imported library
> does not exist yet.
> This sounds like a real dependency to me, not an artificial one.
I wrote the test originally. It is not a real dependency.
The exp_ and bld_ namespaces should be completely separate.
One is from install(EXPORT). One is from export().
The export() case does some targets first and then the rest of
them via export(APPEND):
export(TARGETS ... testExe2libImp ...
NAMESPACE bld_ FILE ExportBuildTree.cmake)
export(TARGETS ... testExe2lib ...
NAMESPACE bld_ APPEND FILE ExportBuildTree.cmake)
The APPEND mode should be appending to the existing export set
with the same namespace. Currently the second call is looking
at "testExe2lib" and trying to find another export that provides
its dependency "testExe2libImp". It is incorrectly finding
the "exp_" install(EXPORT) for "testExe2libImp". This is where
the artificial dependency is getting introduced by the C++ code.
> So changing the order seems to me like the right thing to do.
It is not. It is wrong. The C++ code needs to be fixed. The
change to the test needs to be reverted.
> How should an imported target created via export() behave in your opinion ?
I'm saying that an *export set* created by export() should not
be something that install(EXPORT) can search while looking for
dependencies, and vice versa.
-Brad
More information about the cmake-developers
mailing list