[cmake-developers] Exporting an imported target not supported?

Lassi Niemistö lassi.niemisto at wapice.com
Tue Mar 12 10:12:49 EDT 2019


> We have not thought deeply through the semantics of that in general.
> One of the main challenges is relocation handling.  Targets installed by the project have known locations relative to the install prefix and we expect 
> that everything gets relocated together.  Targets from external places have no such relationship.

Sure, this only works in case the locations are known. In my case, extlib is coming from a custom debian package, which locks its location.
Another usage scenario could be to actually install (make a copy of) the imported library as it would be compiled from the tree. Not generally a preferable solution but there are some use cases I could think of.

> If you're hard-coding paths anyway then I suggest simply linking via absolute path instead of using an imported target.  
> If you do need usage requirements, do it through a non-imported interface library:

True, this is a good tip I could consider. My mind was stuck with IMPORTED :)

-Lassi


More information about the cmake-developers mailing list