UNKNOWN IMPORTED vs INTERFACE IMPORTED for non-CMake library

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

UNKNOWN IMPORTED vs INTERFACE IMPORTED for non-CMake library

Matthew Trescott
Hi,

I somewhat recently filed a bug report regarding target_link_libraries
favoring target names over library names
(https://gitlab.kitware.com/cmake/cmake/issues/17911). Brad King
suggested also that I switch to UNKNOWN instead of INTERFACE for the
IMPORTed targets created by my find-modules.

In my case, it seems that an INTERFACE library would be less fragile
since it can make use of pkg-config instead of manually calling
find_library and find_file. But is INTERFACE considered bad? I have
the impression from the add_library documentation that INTERFACE
libraries are meant for non-compiled things that are part of the
project, but if that is the case, why is there an INTERFACE IMPORTED
option?

I'm looking for clarification on the difference between INTERFACE
IMPORTED and UNKNOWN IMPORTED and whether I should switch my own
library to the latter.

Matthew Trescott
--

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