[CMake] UNKNOWN IMPORTED vs INTERFACE IMPORTED for non-CMake library

Matthew Trescott matthewtrescott at gmail.com
Mon Apr 23 17:06:54 EDT 2018


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


More information about the CMake mailing list