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

Add build_modules to cpp_info and manage CMake modules #5940

Merged
merged 23 commits into from Oct 30, 2019

Conversation

danimtb
Copy link
Member

@danimtb danimtb commented Oct 18, 2019

Changelog: Feature: Add cpp_info.build_modules to manage build system modules like additional CMake functions in packages
Docs: conan-io/docs#1465

  • Refer to the issue that supports this Pull Request: closes CMake generators including .cmake in builddirs #5798
  • If the issue has missing info, explain the purpose/use case/pain/need that covers this Pull Request.
  • I've read the Contributing guide.
  • I've followed the PEP8 style guides for Python code.
  • I've opened another PR in the Conan docs repo to the develop branch, documenting this one.

Note: By default this PR will skip the slower tests and will use a limited set of python versions. Check here how to increase the testing level by writing some tags in the current PR body text.

@danimtb danimtb added this to the 1.20 milestone Oct 18, 2019
@danimtb danimtb self-assigned this Oct 18, 2019
conans/model/build_info.py Outdated Show resolved Hide resolved
else:
return abs_paths

@property
def build_modules_paths(self):
Copy link
Member Author

Choose a reason for hiding this comment

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

The property is needed in order to convert the relative paths to absolute

@danimtb
Copy link
Member Author

danimtb commented Oct 23, 2019

Worked on a real example using the pybind11 library. Changes required can be found here: https://github.com/conan-community/conan-pybind11/compare/release/2.3.0...danimtb:release/2.3.0_build_modules?expand=1

The "cannonical" way of using this library is described here: https://pybind11.readthedocs.io/en/stable/compiling.html#building-with-cmake

@danimtb danimtb changed the title [WIP] Add build_modules to cpp_info and manage CMake modules Add build_modules to cpp_info and manage CMake modules Oct 25, 2019
@danimtb danimtb assigned lasote and unassigned danimtb Oct 25, 2019
@lasote lasote assigned memsharded and lasote and unassigned lasote Oct 28, 2019
conans/client/generators/cmake_common.py Outdated Show resolved Hide resolved
conans/client/generators/cmake_find_package.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
conans/client/generators/cmake_common.py Outdated Show resolved Hide resolved
conans/client/generators/cmake_find_package_common.py Outdated Show resolved Hide resolved
conans/client/generators/cmake_find_package_multi.py Outdated Show resolved Hide resolved
conans/model/build_info.py Outdated Show resolved Hide resolved
@danimtb danimtb requested a review from lasote October 28, 2019 16:26
@lasote lasote removed their assignment Oct 28, 2019
@danimtb
Copy link
Member Author

danimtb commented Oct 28, 2019

Added docs

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.

I am not sure this fulfills the specification we had in mind, with 2 different fields:

  • cpp_info.build_modules: will inject and load those files (can assume they exists)
  • cpp_info.build_modules_paths: will add those paths to the build system search path

The later was necessary for functionality that users don't want to auto-load, but want to explicitly include() in their CMakeLists.txt. I think it is not necessary to filter empty directories in the build_modules_paths. This one can also be used to define paths in case the automatically injected ones transitively include other .cmake scripts in the package.

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

danimtb commented Oct 30, 2019

Changes done!

@lasote lasote merged commit 7482b02 into conan-io:develop Oct 30, 2019
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.

CMake generators including .cmake in builddirs
3 participants