[CMake] Imported targets with additional dependencies

Hauke Heibel hauke.heibel at gmail.com
Wed Nov 19 08:26:54 EST 2014


Hi,

I would like to declare an imported target which uses a header only library
and which has some further link dependencies. If need be, I can specify a
use case for this.

I thought I could simply declare this target as

add_library(Foo::Foo UNKNOWN IMPORTED)

and then configure its dependencies via the target property
IMPORTED_LOCATION.

This used to work in 3.0.2, since it allowed me to specify multiple
libraries separated by a semicolon (see here http://pastebin.com/Y1SYJFHh)
but int 3.1-rc2 this semicolon is escaped to/replace by %3B. I was told
that happens since there should only ever be a single entity specified by
"IMPORTED_LOCATION".

So I got the suggestion to use LINK_INTERFACE_LIBRARIES instead. When
linking against such a target via target_link_libraries(Bar Foo::Foo)
without specifying the IMPORTED_LOCATION property, I get Foo::Foo-NOTFOUND
in my linker dependencies.

The thing is I cannot specify IMPORTED_LOCATION, since there is really
none. I could use my first library dependency to fake one but that does not
sound right.

I also cannot define my imported library as an INTERFACE target because for
these, LINK_INTERFACE_LIBRARIES is not supported.

Is there any way to achieve the declaration of such a target in 3.1?

Regards,
Hauke
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20141119/c66d9b83/attachment.html>


More information about the CMake mailing list