Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

global cpp_info can be used to initialize components #13994

Conversation

memsharded
Copy link
Member

@memsharded memsharded commented May 29, 2023

Changelog: Feature: Global cpp_info can be used to initialize components values.
Docs: omit

This is a long standing issue, where users that define self.cpp_info.includedirs = ["myinclude"] are surprised that individual components will not use the myinclude folder too.

There could be different approaches to this, I have implemented the following:

  • Components are initialized at first instantiation from the values of the global cpp_info
  • That means that later changes to self.cpp_info are not taken into account.

@memsharded memsharded added this to the 2.0.7 milestone May 29, 2023
@@ -572,6 +572,8 @@ def package_info(self):
self.cpp_info.set_property("pkg_config_name", "pkg_other_name")
self.cpp_info.set_property("pkg_config_aliases", ["pkg_alias1", "pkg_alias2"])
self.cpp_info.components["cmp1"].libs = ["libcmp1"]
self.cpp_info.components["cmp1"].libdirs = ["lib"]
Copy link
Member Author

Choose a reason for hiding this comment

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

These tests were ill-formed in the first place, because they were defining things that doesn't work. Yes, they are serialized, but most generators just discard the global cpp_info definition.

@@ -32,6 +32,7 @@ def build(self):

def layout(self):
cmake_layout(self, src_folder="src")
self.cpp.source.includedirs = []
Copy link
Member Author

Choose a reason for hiding this comment

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

It is important to invalidate the non-existing includedirs in conanfile.cpp.source.includedirs = ["include"] inside cmake_layout()

@memsharded memsharded modified the milestones: 2.0.7, 2.0.8 Jun 16, 2023
@memsharded memsharded modified the milestones: 2.0.8, 2.0.9 Jul 11, 2023
@memsharded memsharded modified the milestones: 2.0.9, 2.0.10 Jul 19, 2023
@memsharded memsharded modified the milestones: 2.0.10, 2.0.11 Aug 20, 2023
@memsharded memsharded modified the milestones: 2.0.11, 2.0.12 Sep 13, 2023
@czoido czoido modified the milestones: 2.0.12, 2.0.13, 2.0.14 Sep 26, 2023
@memsharded memsharded modified the milestones: 2.0.14, 2.0.15 Oct 26, 2023
@memsharded
Copy link
Member Author

This is too risky, better wait until cpp_info is changed (maybe for CPS work)

@memsharded memsharded closed this Nov 24, 2023
@memsharded memsharded deleted the feature/cpp_info_global_to_components branch November 24, 2023 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants