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

Fix module CMakeDeps vars and call find_dependency for transitive modules #10227

Merged
merged 10 commits into from Dec 28, 2021

Conversation

czoido
Copy link
Contributor

@czoido czoido commented Dec 22, 2021

Changelog: Fix: Fix variable names set by CMakeDeps modules.
Changelog: Fix: Call to find_dependency in module mode to find transitive dependencies.
Changelog: Feature: Add <PackageName>_LIBRARIES, <PackageName>_INCLUDE_DIRS, <PackageName>_INCLUDE_DIR, <PackageName>_DEFINITIONS and <PackageName>_VERSION_STRING variables in CMakeDeps.
Docs: omit

Closes: #10224

When only cmake_find_mode == "module" was used in CMakeDeps, transitive dependencies were not correctly found. Also, related with that variable names were not generated correctly.

@czoido czoido requested a review from lasote December 22, 2021 14:54
@czoido czoido added this to the 1.44 milestone Dec 22, 2021
@czoido czoido marked this pull request as draft December 22, 2021 15:17
@czoido czoido removed the request for review from lasote December 22, 2021 15:17
conan/tools/cmake/cmakedeps/templates/config.py Outdated Show resolved Hide resolved
related to https://github.com/conan-io/conan/issues/10224
modules files variables were set with the pkg_name_FOUND or pkg_name_VERSION
instead of using filename_*, also there was missing doing a find_dependency of the
requires packages to find_package transitive dependencies
Copy link
Member

Choose a reason for hiding this comment

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

Nice test with clear explanation 👍

@czoido czoido marked this pull request as ready for review December 22, 2021 17:48
Comment on lines 74 to 75
set({{ file_name }}_INCLUDE_DIRS {{ '${' + pkg_name + '_INCLUDE_DIRS' + config_suffix + '}' }} )
set({{ file_name }}_LIBRARIES {{ '${' + pkg_name + '_LIBRARIES' + config_suffix + '}' }} )
Copy link
Contributor

@SpaceIm SpaceIm Dec 22, 2021

Choose a reason for hiding this comment

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

I don't know if they are defined elsewhere, but it would be very nice to add:
<file_name>_INCLUDE_DIR> (the no S flavour of <file_name>_INCLUDE_DIRS>)
<file_name>_DEFINITIONS>
<file_name>_VERSION_STRING>

Grep _create_cmake_module_variables in CCI, you'll see that these 3 variables are recurrent.

Copy link
Member

Choose a reason for hiding this comment

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

Can we easily add these @czoido ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I'll add those 👍

@memsharded memsharded merged commit 8c389f5 into conan-io:develop Dec 28, 2021
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.

CMakeDeps should use the module file name to create Find<pkg>.cmake variables
5 participants