Skip to content

Fix transitive_libs=True when using CMakeConfigDeps for shared libraries#19815

Merged
memsharded merged 17 commits into
conan-io:develop2from
AbrilRBS:ar/cmakeconfigdeps-transitive-libraries-link
Apr 27, 2026
Merged

Fix transitive_libs=True when using CMakeConfigDeps for shared libraries#19815
memsharded merged 17 commits into
conan-io:develop2from
AbrilRBS:ar/cmakeconfigdeps-transitive-libraries-link

Conversation

@AbrilRBS

@AbrilRBS AbrilRBS commented Mar 31, 2026

Copy link
Copy Markdown
Member

Changelog: Bugfix: Fix transitive_libs=True when using CMakeConfigDeps for shared libraries.
Docs: Omit

Closes #19801

@AbrilRBS AbrilRBS added this to the 2.28.0 milestone Mar 31, 2026
@AbrilRBS AbrilRBS requested a review from franramirez688 April 1, 2026 16:12
@AbrilRBS AbrilRBS changed the title Sketch fix for transitive libs with CMakeConfigDeps Fix transitive_libs=True when using CMakeConfigDeps for shared libraries Apr 1, 2026
@AbrilRBS AbrilRBS marked this pull request as ready for review April 1, 2026 16:13
dep_target = dep_target or f"{d.ref.name}::{d.ref.name}"
link_feature = self._cmakedeps.get_property("cmake_link_feature", d)
link = not (pkg_type is PackageType.SHARED and d.package_type is PackageType.SHARED)
link = (req.libs or

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.

I am just wondering, why reqs.libs is not enough. In theory it should already correctly propagate linkage requirements. Maybe I was too obssesed about the use case of shared->shared that I hardcoded it here, while it is not really necessary. I think it is worth to try and run with link = req.libs only and see what happens with the tests (there should be tests to cover this use case)

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.

I will test it now

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What about this case?
Couldn't there a similar problem?

Or is this not possible (yet)?
But #19641 seems to address this limitation, leading to a similar problem here, right?

@memsharded memsharded merged commit 215af11 into conan-io:develop2 Apr 27, 2026
17 checks passed
memsharded added a commit to memsharded/conan that referenced this pull request Apr 27, 2026
…aries (conan-io#19815)

* Failing test

* Porposed fix

* Shared

* Cleanup API, cleanup example

* Better api

* Update test_cmakeconfigdeps_new.py

* Better use libs

* trying if 'req.libs' is enough

* Test!

* review

* new test, more real with transitive_headers=True and static function

* Static variant just in case

---------

Co-authored-by: Francisco Ramírez <franchuti688@gmail.com>
Co-authored-by: memsharded <james@conan.io>
czoido added a commit that referenced this pull request Apr 28, 2026
…required_conan_version`` (#19907)

* decouple new core:policy_conan_version

* review, using OR

* Extra test case, test cleanup

* reduce diff

* Fix `transitive_libs=True` when using CMakeConfigDeps for shared libraries (#19815)

* Failing test

* Porposed fix

* Shared

* Cleanup API, cleanup example

* Better api

* Update test_cmakeconfigdeps_new.py

* Better use libs

* trying if 'req.libs' is enough

* Test!

* review

* new test, more real with transitive_headers=True and static function

* Static variant just in case

---------

Co-authored-by: Francisco Ramírez <franchuti688@gmail.com>
Co-authored-by: memsharded <james@conan.io>

* Move some recipe-related deprecations to policy-based (#19892)

* Put Conanfile path accessors under conf

* Fix tests to use conf

* Fix test syntaxt

* tests for path methods

* Failing test for deprecation

* Failing test for deprecation

* Core conf

* wip

* Naming

* Use global conf

* Typo

* Update conan/internal/model/conf.py

Co-authored-by: Carlos Zoido <mrgalleta@gmail.com>

* Update conan/cli/printers/graph.py

Co-authored-by: Carlos Zoido <mrgalleta@gmail.com>

* Cleanup conanfile diff

* Tests for ensuring we remove support for this in 2.32

---------

Co-authored-by: Carlos Zoido <mrgalleta@gmail.com>

* new policies

* review

* fix tests

* fix conf help

---------

Co-authored-by: Abril Rincón Blanco <5364255+AbrilRBS@users.noreply.github.com>
Co-authored-by: Francisco Ramírez <franchuti688@gmail.com>
Co-authored-by: Carlos Zoido <mrgalleta@gmail.com>
czoido pushed a commit to czoido/conan that referenced this pull request Apr 28, 2026
…aries (conan-io#19815)

* Failing test

* Porposed fix

* Shared

* Cleanup API, cleanup example

* Better api

* Update test_cmakeconfigdeps_new.py

* Better use libs

* trying if 'req.libs' is enough

* Test!

* review

* new test, more real with transitive_headers=True and static function

* Static variant just in case

---------

Co-authored-by: Francisco Ramírez <franchuti688@gmail.com>
Co-authored-by: memsharded <james@conan.io>
czoido added a commit to czoido/conan that referenced this pull request Apr 28, 2026
…required_conan_version`` (conan-io#19907)

* decouple new core:policy_conan_version

* review, using OR

* Extra test case, test cleanup

* reduce diff

* Fix `transitive_libs=True` when using CMakeConfigDeps for shared libraries (conan-io#19815)

* Failing test

* Porposed fix

* Shared

* Cleanup API, cleanup example

* Better api

* Update test_cmakeconfigdeps_new.py

* Better use libs

* trying if 'req.libs' is enough

* Test!

* review

* new test, more real with transitive_headers=True and static function

* Static variant just in case

---------

Co-authored-by: Francisco Ramírez <franchuti688@gmail.com>
Co-authored-by: memsharded <james@conan.io>

* Move some recipe-related deprecations to policy-based (conan-io#19892)

* Put Conanfile path accessors under conf

* Fix tests to use conf

* Fix test syntaxt

* tests for path methods

* Failing test for deprecation

* Failing test for deprecation

* Core conf

* wip

* Naming

* Use global conf

* Typo

* Update conan/internal/model/conf.py

Co-authored-by: Carlos Zoido <mrgalleta@gmail.com>

* Update conan/cli/printers/graph.py

Co-authored-by: Carlos Zoido <mrgalleta@gmail.com>

* Cleanup conanfile diff

* Tests for ensuring we remove support for this in 2.32

---------

Co-authored-by: Carlos Zoido <mrgalleta@gmail.com>

* new policies

* review

* fix tests

* fix conf help

---------

Co-authored-by: Abril Rincón Blanco <5364255+AbrilRBS@users.noreply.github.com>
Co-authored-by: Francisco Ramírez <franchuti688@gmail.com>
Co-authored-by: Carlos Zoido <mrgalleta@gmail.com>
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.

[bug] CMakeConfigDeps: transitive_libs=True has no effect

4 participants