add pkgconfig components to brotli recipe in CCI using https://github.com/conan-io/conan-center-index/pull/2319:
def package_info(self):
includedir = os.path.join("include", "brotli")
# brotlicommon
self.cpp_info.components["brotlicommon"].names["pkg_config"] = "libbrotlicommon"
self.cpp_info.components["brotlicommon"].includedirs.append(includedir)
self.cpp_info.components["brotlicommon"].libs = [self._get_decorated_lib("brotlicommon")]
# brotlidec
self.cpp_info.components["brotlidec"].names["pkg_config"] = "libbrotlidec"
self.cpp_info.components["brotlidec"].includedirs.append(includedir)
self.cpp_info.components["brotlidec"].libs = [self._get_decorated_lib("brotlidec")]
self.cpp_info.components["brotlidec"].requires = ["brotlicommon"]
# brotlienc
self.cpp_info.components["brotlienc"].names["pkg_config"] = "libbrotlienc"
self.cpp_info.components["brotlienc"].includedirs.append(includedir)
self.cpp_info.components["brotlienc"].libs = [self._get_decorated_lib("brotlienc")]
self.cpp_info.components["brotlienc"].requires = ["brotlicommon"]
if self.settings.os == "Linux":
self.cpp_info.components["brotlienc"].system_libs = ["m"]
if self.settings.os == "Windows" and self.options.shared:
self.cpp_info.components["brotlicommon"].defines.append("BROTLI_SHARED_COMPILATION")
self.cpp_info.components["brotlidec"].defines.append("BROTLI_SHARED_COMPILATION")
self.cpp_info.components["brotlienc"].defines.append("BROTLI_SHARED_COMPILATION")
def _get_decorated_lib(self, name):
libname = name
if not self.options.shared:
libname += "-static"
return libname
pkg_config generator in test_package (and keep cmake generator)conan create . brotli/1.0.7@brotli/1.0.7 (test package): Generator pkg_config created libbrotlicommon.pc
brotli/1.0.7 (test package): Generator pkg_config created libbrotlienc.pc
brotli/1.0.7 (test package): Generator pkg_config created libbrotlidec.pc
brotli/1.0.7 (test package): Generator pkg_config created brotli.pc
brotli/1.0.7 (test package): ERROR: Generator cmake(file:conanbuildinfo.cmake) failed
'libbrotlicommon'
ERROR: 'libbrotlicommon'
If pkg_config generator is removed from test_package, cmake generator succeeds.
most probably linked: when using cmake generator on a package requiring libpq, this error happens:
ERROR: Generator cmake(file:conanbuildinfo.cmake) failed
'pgcommon'
Traceback (most recent call last):
File "/Users/runner/hostedtoolcache/Python/3.7.8/x64/lib/python3.7/site-packages/conans/client/generators/__init__.py", line 108, in write_generators
content = generator.content
File "/Users/runner/hostedtoolcache/Python/3.7.8/x64/lib/python3.7/site-packages/conans/client/generators/cmake.py", line 109, in content
sections.extend(generate_targets_section(self.deps_build_info.dependencies, "cmake"))
File "/Users/runner/hostedtoolcache/Python/3.7.8/x64/lib/python3.7/site-packages/conans/client/generators/cmake_common.py", line 224, in generate_targets_section
use_deps = ["CONAN_PKG::%s" % dependencies_dict[d].get_name(generator_name) for d in dep_info.public_deps]
File "/Users/runner/hostedtoolcache/Python/3.7.8/x64/lib/python3.7/site-packages/conans/client/generators/cmake_common.py", line 224, in <listcomp>
use_deps = ["CONAN_PKG::%s" % dependencies_dict[d].get_name(generator_name) for d in dep_info.public_deps]
KeyError: 'pgcommon'
see also: https://github.com/conan-io/conan-center-index/pull/2382
also, when using cmake generator on a package requiring openssl, the following error happens:
ERROR: Generator cmake(file:conanbuildinfo.cmake) failed
'libcrypto'
Traceback (most recent call last):
File "/opt/pyenv/versions/3.7.5/lib/python3.7/site-packages/conans/client/generators/__init__.py", line 108, in write_generators
content = generator.content
File "/opt/pyenv/versions/3.7.5/lib/python3.7/site-packages/conans/client/generators/cmake.py", line 109, in content
sections.extend(generate_targets_section(self.deps_build_info.dependencies, "cmake"))
File "/opt/pyenv/versions/3.7.5/lib/python3.7/site-packages/conans/client/generators/cmake_common.py", line 224, in generate_targets_section
use_deps = ["CONAN_PKG::%s" % dependencies_dict[d].get_name(generator_name) for d in dep_info.public_deps]
File "/opt/pyenv/versions/3.7.5/lib/python3.7/site-packages/conans/client/generators/cmake_common.py", line 224, in <listcomp>
use_deps = ["CONAN_PKG::%s" % dependencies_dict[d].get_name(generator_name) for d in dep_info.public_deps]
KeyError: 'libcrypto'
see also https://github.com/conan-io/conan-center-index/pull/2383
Last week, I was seeing something similar on Windows:
https://github.com/conan-io/conan-center-index/pull/2351#issuecomment-667236099
I've found the bug introduced by the pkg_config+components generator. I'll have a look to the ncurses one @madebr has just linked.
Last week, I was seeing something similar on Windows:
conan-io/conan-center-index#2351 (comment)
It is the same issue, pkg_config wrongly modifies cpp_info values.
Most helpful comment
I've found the bug introduced by the
pkg_config+components generator. I'll have a look to thencursesone @madebr has just linked.