Conan: How to avoid link warnings with header-only dependencies in cmake based recipes?

Created on 3 Dec 2016  路  4Comments  路  Source: conan-io/conan

When using header-only libs like zmqcpp or catch with the cmake generator like:

[requires]
catch/1.5.0@TyRoXx/stable
zmqcpp/4.2.0@sourcedelica/testing

[generators]
cmake

you get linker warnings like:

ld: warning: directory not found for option '-L/Users/eric/.conan/data/catch/1.5.0/TyRoXx/stable/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/lib'
ld: warning: directory not found for option '-L/Users/eric/.conan/data/zmqcpp/4.2.0/sourcedelica/testing/package/1686cbbda545ba2177cad298877b69c2401b9b59/lib'

Is there something I can do in the dependency package (for example libzmq in this example) recipe to avoid this? Or in the client package recipe? Though I would prefer fixing it at the source.

Most helpful comment

Not sure if it is up to the quality needed (I also didn't run the regression tests), but this fixes the warnings for me:

https://github.com/ruipires/conan/commit/cdf5a282e1c6b733295ab19e9fa18e1c02b3bbd0

All 4 comments

This issue also bothers me (I'm very picky with warnings).

I don't know of a way to fix this in either the depencency or client package. Others may help here.

The only way I do know that could fix this requires a small change in conan itself: check if the actual library is empty and remove it from the cmake variable (not sure where best to do this, most likely in the cmake generator itself).

I have tried this and the warning is indeed gone (was not able to run the tests, so I have no idea of possible side-effects).

Not sure if it is up to the quality needed (I also didn't run the regression tests), but this fixes the warnings for me:

https://github.com/ruipires/conan/commit/cdf5a282e1c6b733295ab19e9fa18e1c02b3bbd0

I think it has an easy solution. The issue is that conan is by default adding the "lib" path to the libdirs. I think that doing:

def package_info(self):
    self.cpp_info.libdirs = []

Should fix it.
It is possible that header-only package creators forget about it, but that would be the preferred way to fix the warnings.

Yep, that did it. I just added it to my clones of conan-catch and conan-zmqcpp and it worked. Thx!

Was this page helpful?
0 / 5 - 0 ratings