Using conan_toolchain.cmake when generating it from CMake itself
See original GitHub issueI am starting to test conan and I am using the CMakeToolchain generator. However, instead of calling conan install .
, I am calling it through the CMake conan.cmake
package.
So if I just run
cmake -S . --preset whatever
the conan_toolchain.cmake file is generated correctly. On the next run I can do
cmake -S . preset whatever -DCMAKE_TOOLCHAIN_FILE=...
This is unconvenient, as I have to run twice the configuration
However, if I try to run directly with the toolchain file on a clean build, it simply fails to configure because the toolchain is not found. Is there any workaround for this?
Issue Analytics
- State:
- Created a year ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Using conan_toolchain.cmake when generating it ... - GitHub
I am starting to test conan and I am using the CMakeToolchain generator. However, instead of calling conan install . , I am...
Read more >Cross Compiling With CMake
In order to use CMake for cross-compiling, a CMake file that describes the target platform has to be created, called the “toolchain file,”...
Read more >CMakeToolchain — conan 1.53.0 documentation
The CMakeToolchain is the toolchain generator for CMake. It will generate toolchain files that can be used in the command line invocation of...
Read more >CMake Tutorial - Medium
CMake can generate a native build environment that will compile source code, ... CMake itself is a software program, so it should be...
Read more >Building LLVM with CMake — LLVM 16.0.0git documentation
txt stored at the root of your build directory that is generated by cmake . Editing it yourself is not recommended. Variables are...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @jjcasmar,
Thanks a lot for your question. The use of cmake-conan with CMakeToolchain generator is not recommended. In fact, cmake-conan does not support Conan 2.0 and we don’t know yet if it will. Please, check the comments in this issue about that: https://github.com/conan-io/cmake-conan/issues/410#issuecomment-1095611994 I opened a PR warning about this here: https://github.com/conan-io/cmake-conan/pull/437 I would recommend you to do a conan install directly. We are making lots of improvements in the preset support (better if you use CMake>=3.23) and also you can define the layout now in the conanfile.txt that should make everything easier. There’s some information in this blogpost about the latest release: https://blog.conan.io/2022/06/16/New-conan-release-1-49.html
In the preset I am adding some build options. However, as you said,
(better if you use CMake>=3.23)
in CMake 3.23 you can include one preset from another, so probably the developer can add the preset generated by conan on its own preset.At some point it will be nice if calling cmake could code conan anyway. It will be much easier to integrate.
The last thing I am thinking is how to deal with release/debug mode on dependencies. Most of the time you dont want your dependencies build on Debug mode, even if you are compiling in Debug mode your code. This can be solved with profiles, right?