You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This raises an issue when you want to mix static linking of just some system libraries, such as the case of libm using -Wl,-Bstatic -lstdc++ -lm -Wl,-Bdynamic
The issue is that system libraries of the conan recipes that added it as a dependency are repeated in the linking command:
Whe are porting some custom makefiles with Conan v1 to Cmake + Conan 2.
From what I understand reading the issue, this is not something new due to the migration. I think that system_libs treatment as always been very similar, and it was not possible to differentiate between static/dynamic in Conan 1 either.
This raises an issue when you want to mix static linking of just some system libraries, such as the case of libm using -Wl,-Bstatic -lstdc++ -lm -Wl,-Bdynamic
Quick question, you are using recipes and packages from ConanCenter, or are you using your own recipes? Or maybe at least building the binaries from a conan-center-index Github source repo fork? I am asking in case you could change the recipes to customize it.
Regarding your attempt to remove the libraries from the consumer side CMake code, a couple of quick questions:
foreach(lib ${project_libraries}) how do you get project_libraries? The targets that actually get the flags are inner targets, the package::package targets are typically just interface targets that link other internal targets that define the properties, flags, etc. So it would be needed to iterate deeper in the targets graph.
Are you sure that if(lib STREQUAL "-lm") works? I think the property is a list of libraries, not a list of flags. It would be very useful to print the values to check.
I'd try to add more logs to the cmake code, printing the targets, the target properties, whether the if() matches or not, etc.
What is your question?
Whe are porting some custom makefiles with Conan v1 to Cmake + Conan 2.
Some recipes, such as libpng, use this approach:
This raises an issue when you want to mix static linking of just some system libraries, such as the case of
libm
using-Wl,-Bstatic -lstdc++ -lm -Wl,-Bdynamic
The issue is that system libraries of the conan recipes that added it as a dependency are repeated in the linking command:
So the executable is linked dynamically to
libm
:We need to still statically link some system libraries like
libm
because we need to support old distros that have outdated libs.I tried to hack the dependencies in CMake to remove
-lm
like this but without success:Any idea about how can we deal with this issue?
Thanks
Have you read the CONTRIBUTING guide?
The text was updated successfully, but these errors were encountered: