On 3/12/19 9:55 AM, Lassi Niemistö wrote:
> is there a technical reason why it would not be a good idea to
> allow exporting the imported targets with all their properties?

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.

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:

```
add_library(extlib INTERFACE)
target_link_libraries(extlib INTERFACE /path/to/libextlib.so)
target_compile_definitions(extlib INTERFACE ...)
```

That can be installed and exported, and the importing side will
simply use the same absolute path.

-Brad
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake-developers

Reply via email to