conan: [bug] self.cpp_info.name breaks pkg-config for some packages
Defining self.cpp_info.name for a package changes (at least) two file names: cmake module FindFOO
files, and pkg-config files. The problem is that in the wild, the name used for cmake module files and pkg-config files are not always identical, for example zlib has FindZLIB
, but zlib.pc
, and expat has FindEXPAT
but expat.pc
.
recipes consuming these two packages via pkg-config are broken since these two recipes set self.cpp_info.name
to uppercase, the workaround being to rename generated ZLIB.pc
to zlib.pc
and EXPAT.pc
to expat.pc
.
If pkg-config files are always the lower-case version of corresponding findFOO
cmake file, the simplest fix would be to modify pkg-config generator to use self.cpp_info.name.lower()
instead of self.cpp_info.name
. If not, a solution would be to make self.cpp_info.name
a dictionary mapping generators to name.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 15 (15 by maintainers)
The library name appears in the pkg-config file, and is currently in uppercase, but it does not seem to have an impact(renaming the file without modifying content solves the problem). According to https://people.freedesktop.org/~dbn/pkg-config-guide.html, name is
A human-readable name for the library or package. This does not affect usage of the pkg-config tool, which uses the name of the .pc file.
This issue is not fixed by https://github.com/conan-io/conan/pull/5988 (eg freetype2 vs freetype is not a simple case change). EDIT: ok, I did not realize that this feature was tracked in https://github.com/conan-io/conan/issues/5993
Hi @ledocc
yes, this is definitely the way to go. I’d suggest it as a feature for the next 1.21 release.
More generally it seems that we are currently setting
self.cpp_info.name
to match what we need for CMake to work, but we’ve got no guarantee that the case will be the same for every build system. Inconsistencies and related issues are very likely.