conan
conan copied to clipboard
[feature] Better management of fPIC
Now things in our template works relatively well, because the default is fPIC=True, for static and shared libraries.
If some users default it to False, then it will be a bit inconvenient, because it is necessary to:
- Put the
fPIC=Trueforshared=True(besides setting theshared=True, because otherwise for example https://cmake.org/cmake/help/latest/prop_tgt/POSITION_INDEPENDENT_CODE.html#prop_tgt:POSITION_INDEPENDENT_CODE, that default invalidates the CMake one, and will error, which is a different behavior than not definingfPICat all - Put all the static libraries transitive dependencies to
fPIC=True, which might be difficult to handle, specially if we don't want to just put everything in the graph asfPIC=True. It seems that a recipe should do something in the line of:
def configure(self):
if self.options.shared:
self.options[*":fPIC"] = True
Something similar happens if we want, leaving the fPIC=True default, to change to False those that are static libraries not reused by shared ones, it would be quite challenging to do it from the consumer side.
Is it maybe something to propagate automatically like a trait?
Something similar happens if we want, leaving the fPIC=True default, to change to False those that are static libraries not reused by shared ones, it would be quite challenging to do it from the consumer side.
Is it maybe something to propagate automatically like a trait?
I don't see it as a trait but maybe in a similar case, we talked about the language attribute that would remove libcxx and cppstd when C. Maybe the configure should have by default a "smart" adjustment based on the shared of transitive dependencies and reading the shared option of the recipe itself.
Too much and too new for current moment, moving it to 2.X
This was addressed with the new implements attribute in Conan 2.0.9 (https://github.com/conan-io/conan/pull/14320), closing as solved, see https://docs.conan.io/2/changelog.html#jul-2023