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

[question] Extend CMAKE_MODULE_PATH/CMAKE_PREFIX_PATH at consumers #4004

Open
1 task done
aagor opened this issue Feb 19, 2025 · 3 comments
Open
1 task done

[question] Extend CMAKE_MODULE_PATH/CMAKE_PREFIX_PATH at consumers #4004

aagor opened this issue Feb 19, 2025 · 3 comments
Assignees
Milestone

Comments

@aagor
Copy link

aagor commented Feb 19, 2025

What is your question?

Hi,

I want to package some CMake build scripts in a conan package.
For include(some-build-script.cmake) to work at consumers of this package, they must add the path of the CMake scripts to its CMAKE_PREFIX_PATH / CMAKE_MODULE_PATH.

I have not seen a way to conveniently add something like this.
The attributes that can be set inside package_info() don't cover this case.

Have I missed something?
What's the best solution for this problem?

Have you read the CONTRIBUTING guide?

  • I've read the CONTRIBUTING guide
@memsharded memsharded self-assigned this Feb 19, 2025
@memsharded
Copy link
Member

Hi @aagor

I think you are interested in https://docs.conan.io/2/examples/graph/requires/consume_cmake_macro.html

Basically you need to self.cpp_info.builddirs = ["path/with/cmake"] so this path is added to the CMAKE_ paths (via conan_toolchain.cmake from CMakeToolchain

@aagor
Copy link
Author

aagor commented Feb 28, 2025

Hi @memsharded,

thanks, that is exactly what I asked for. I must have missed that.

May I suggest to extend the documentation of find_paths inside the CMakeToolchain documentation, to make that more easily discoverable when searching the documentation for CMAKE_XXXX_PATH (and maybe link the example somewhere)? Adding something like "Also adds the declared builddirs from cpp_info of host dependencies".

@memsharded
Copy link
Member

Yes, sounds good, this is pending some more detailed documentation, but it will probably be associated to the new CMakeConfigDeps generator, as this is information more associated to dependencies than to the toolchain.

Moving the ticket to the docs repo.

@memsharded memsharded transferred this issue from conan-io/conan Feb 28, 2025
@memsharded memsharded added this to the 2 milestone Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants