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

Specify build modules by the generator in cpp_info #8232

Merged
merged 23 commits into from Jan 11, 2021

Conversation

danimtb
Copy link
Member

@danimtb danimtb commented Dec 18, 2020

Changelog: Feature: Specify build modules by the generator in cpp_info. Added backwards compatibility for *.cmake build modules added at global scope, but not for other file extensions.
Docs: conan-io/docs#1986

@danimtb danimtb self-assigned this Dec 18, 2020
@danimtb danimtb assigned jgsogo and unassigned danimtb Dec 21, 2020
@danimtb danimtb marked this pull request as ready for review December 21, 2020 15:03
@danimtb danimtb added this to the 1.33 milestone Dec 21, 2020
Copy link
Contributor

@jgsogo jgsogo left a comment

Choose a reason for hiding this comment

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

I agree this is more explicit behavior, but it will break existing behavior for recipes that are appending files to cpp_info.build_modules.append(...), will they lose all the build_modules?

Copy link
Member

@memsharded memsharded left a comment

Choose a reason for hiding this comment

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

As commented by @jgsogo if we would like to keep the previous "global" build_modules so we don't break to users (even if experimental), I would vote for adding the functionality for new generators only, that do not need an aggregated dict of build_modules, because every file will include its own ones.

conans/client/generators/cmake_multi.py Outdated Show resolved Hide resolved
conans/model/build_info.py Outdated Show resolved Hide resolved
conans/model/build_info.py Show resolved Hide resolved
@danimtb
Copy link
Member Author

danimtb commented Dec 23, 2020

Added the possibility of reading build_modules as a list and adding the specific .cmake modules to all the current CMake generators. This is done for backward compatibility and should be removed in the following releases.

@danimtb danimtb assigned memsharded and unassigned jgsogo Dec 28, 2020
conans/model/build_info.py Outdated Show resolved Hide resolved
conans/model/build_info.py Outdated Show resolved Hide resolved
conans/model/build_info.py Outdated Show resolved Hide resolved
conans/model/build_info.py Show resolved Hide resolved
conans/model/build_info.py Outdated Show resolved Hide resolved
conans/model/build_info.py Outdated Show resolved Hide resolved
@@ -557,37 +557,49 @@ def setUp(self):
cpp_info = CppInfo(ref.name, "dummy_root_folder1")
cpp_info.filter_empty = False # For testing purposes only
cpp_info.name = ref.name
cpp_info.build_modules = ["my-module.cmake"]
Copy link
Member

Choose a reason for hiding this comment

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

Will the assignment fail? I see the existing implementation keeps append() and extend(), but not sure about the build_modules = ["..."] one. Would this be breaking?

Copy link
Member Author

Choose a reason for hiding this comment

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

@@ -390,7 +390,7 @@ def package_info(self):
""")
# This is a module that defines some functionality
find_module = textwrap.dedent("""
function(conan_message MESSAGE_OUTPUT)
function(custom_message MESSAGE_OUTPUT)
Copy link
Member Author

Choose a reason for hiding this comment

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

to avoid using conan_message() defined by the generator

@danimtb danimtb assigned jgsogo and unassigned memsharded Jan 11, 2021
conans/model/build_info.py Outdated Show resolved Hide resolved
conans/model/build_info.py Outdated Show resolved Hide resolved
conans/model/build_info.py Show resolved Hide resolved
conans/client/generators/cmake.py Outdated Show resolved Hide resolved
@danimtb danimtb requested a review from jgsogo January 11, 2021 15:46
Copy link
Contributor

@jgsogo jgsogo left a comment

Choose a reason for hiding this comment

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

I would add a note to the changelog about "backward compatibility for *.cmake build-modules added at global scope, but not for file extensions".

@danimtb
Copy link
Member Author

danimtb commented Jan 11, 2021

added to the changelog!

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.

None yet

3 participants