[CMake] Exporting imported target

Andreas Pakulat apaku at gmx.de
Tue Mar 24 13:13:31 EDT 2009


On 25.03.09 00:01:02, Asmodehn Shade wrote:
> Hi,
> 
> I am assuming it is at the moment (cmake 2.6.2 ) not possible to export an
> imported target...

No.

> What about having the imported target and its properties transitively
> exported again ?
> Has this been planned for the future or ruled out already ?
> 
> If you wonder why I might want to do this, its in the case where I have :
> 
> ProjectA depending on ProjectB depending on ProjectC
> ProjectC is an imported target into ProjectB
> However to build projectA and link ProjectB I must also be able to access
> ProjectC properties...
> I was planning to export projectC from projectB, so that projectA can access
> it and do what it needs with it ( link properly the target without fullpath,
> copy the binary built target (.so ) to run little executable tests in place,
> etc.)

The easiest way to achieve what you want (having targets of
projectB+projectC available to projectA) is by having the
FindProjectB.cmake file simply do a find_package(ProjectC REQUIRED) call
and then make sure that FindProjectC.cmake (or the ConfigProjectC.cmake)
load the file containing the export-information from ProjectC. So instead
of exporting imported target let the original exporting from ProjectC run
automatically when finding ProjectB.

Andreas

-- 
Good night to spend with family, but avoid arguments with your mate's
new lover.


More information about the CMake mailing list