Skip to content

[POC] Preparing multi-file CMakeConfigDeps#20036

Draft
franramirez688 wants to merge 8 commits into
conan-io:develop2from
franramirez688:frm/poc_refactor_cmakedeps
Draft

[POC] Preparing multi-file CMakeConfigDeps#20036
franramirez688 wants to merge 8 commits into
conan-io:develop2from
franramirez688:frm/poc_refactor_cmakedeps

Conversation

@franramirez688

Copy link
Copy Markdown
Contributor

Changelog: omit
Docs: omit

return textwrap.dedent("""\
include_guard()
message(STATUS "Conan: Configuring Targets for {{ ref }}")
message(STATUS "Conan: Configuring Targets for {{ filename }}")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
message(STATUS "Conan: Configuring Targets for {{ filename }}")
message(STATUS "Conan: Configuring Targets for {{ self._filename }}")

raise ConanException(f"Unknown cmake_config_version_compat={policy} in {self._conanfile}")
version = self._cmakedeps.get_property("system_package_version", self._conanfile)
version = version or self._conanfile.ref.version
raise ConanException(f"Unknown cmake_config_version_compat={policy} in {self.filename}")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this filename is not the same as a package name, it can be complicated to know it.
I suggest:

  • Pass the ref instead of the version.
  • Use the ref here
  • Use the ref.version below

foo-config.cmake
"""
def __init__(self, cmakedeps, require, conanfile, full_cpp_info):
def __init__(self, filename, cmakedeps, conanfile, full_cpp_info, cmake_config_properties,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This cmakedeps shouldn't be used anymore? It could be dropped from the parameterization, as it gives access to the global state.

With conanfile is different, as it is still used in places like pkg_name = self._conanfile.ref.name, but for this reason I think it is still necessary to do it, what will be the meaning of that pkg_name when we go and try to implement the "multi-file" feature?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants