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 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 #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):

This comment has been minimized.

Copy link
@danimtb

danimtb Oct 18, 2019

Author Member

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

@danimtb

This comment has been minimized.

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 added 2 commits Oct 28, 2019
@danimtb danimtb requested a review from lasote Oct 28, 2019
@lasote
lasote approved these changes Oct 28, 2019
@lasote lasote removed their assignment Oct 28, 2019
@danimtb

This comment has been minimized.

Copy link
Member Author

danimtb commented Oct 28, 2019

Added docs

Copy link
Member

memsharded left a comment

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

This comment has been minimized.

Copy link
Member Author

danimtb commented Oct 30, 2019

Changes done!

@lasote lasote merged commit 7482b02 into conan-io:develop Oct 30, 2019
2 checks passed
2 checks passed
continuous-integration/jenkins/pr-head This commit looks good
Details
license/cla Contributor License Agreement is signed.
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.