Skip to content

CppInfo Components shows cmake_file_name twice #4266

@uilianries

Description

@uilianries

When reading the Components section in package_info, I can find the following example code:

def package_info(self):
    self.cpp_info.components["crypto"].set_property("cmake_file_name", "Crypto")
    self.cpp_info.components["crypto"].libs = ["libcrypto"]
    self.cpp_info.components["crypto"].defines = ["DEFINE_CRYPTO=1"]
    self.cpp_info.components["crypto"].requires = ["zlib::zlib"]  # Depends on all components in zlib package

    self.cpp_info.components["ssl"].set_property("cmake_file_name", "SSL")
    self.cpp_info.components["ssl"].includedirs = ["include/headers_ssl"]
    self.cpp_info.components["ssl"].libs = ["libssl"]

Reference: https://docs.conan.io/2/reference/conanfile/methods/package_info.html#components

However, it's not possible to generate two separate CMake config files using CMakeDeps, neither CMakeConfigDeps, instead, it will generate <package_name>Config.cmake

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions