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] How to replace conanbuildinfo.cmake #17097

Open
1 task done
diogomatos3 opened this issue Oct 1, 2024 · 2 comments
Open
1 task done

[question] How to replace conanbuildinfo.cmake #17097

diogomatos3 opened this issue Oct 1, 2024 · 2 comments
Assignees
Labels
responded Responded by Conan team type: question

Comments

@diogomatos3
Copy link

What is your question?

Hello community,

In my project, we still generate conanbuildinfo.cmake and run conan_basic_setup().
We would like to migrate and use CMakeToolchain and CMakeDeps instead.

But unfortunately, we get now several "No such file or directory" errors. So the path to the header files seems to be unknown. Something that conan_basic_setup() macro was covering.

How to proceed?

I am basically following https://docs.conan.io/en/1.64/reference/conanfile/tools/cmake/cmake.html#cmake

Thanks in advance.

Have you read the CONTRIBUTING guide?

  • I've read the CONTRIBUTING guide
@memsharded
Copy link
Member

Hi @diogomatos3

The important bit is the "generators". In your linked doc page, you can see:

from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps

 def generate(self):
        tc = CMakeToolchain(self)
        tc.generate()
        deps = CMakeDeps(self)
        deps.generate()

Because the recipe is using the new CMakeToolchain and CMakeDeps generators.
These generators are fully transparent, meaning that nothing should be added to the CMakeLists.txt, so the include(conanbuildinf.cmake) and other related code must be removed.

When you remove them, things should work.
You can see a full working example with the conan new hello/0.1 -m=cmake_lib template, that you can execute in an empty folder, then do conan create .

@memsharded memsharded self-assigned this Oct 1, 2024
@memsharded memsharded added type: question responded Responded by Conan team labels Oct 1, 2024
@memsharded
Copy link
Member

Hi @diogomatos3

Any further question here? Thanks for the feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
responded Responded by Conan team type: question
Projects
None yet
Development

No branches or pull requests

2 participants