I just received help on IRC. The solution is to use an INTERFACE target and INTERFACE_LINK_LIBRARIES (and NOT LINK_INTERFACE_LIBRARIES).
Hauke On Wed Nov 19 2014 at 2:26:54 PM Hauke Heibel <hauke.hei...@gmail.com> wrote: > 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 >
-- 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: http://public.kitware.com/mailman/listinfo/cmake