Closed PauloCarvalhoRJ closed 1 week ago
Hi @PauloCarvalhoRJ
Thanks for your question.
It is the CMakeToolchain.preprocessor_definitions
: https://docs.conan.io/2/reference/tools/cmake/cmaketoolchain.html#preprocessor-definitions for preprocessor definitions
It is CMakeToolchain.cache_variables
: https://docs.conan.io/2/reference/tools/cmake/cmaketoolchain.html#cache-variables for CMake variables stored in CMakePresets.json (passed in command line)
It is CMakeToolchain.variables
: https://docs.conan.io/2/reference/tools/cmake/cmaketoolchain.html#variables, for CMake variables to be defined in the conan_toolchain.cmake
.
All of them defined in the generate()
method.
Hello, @memsharded ,
The new improved API is becoming clearer now. Thanks for the pointers and the further reading.
regards,
PC
The new improved API is becoming clearer now. Thanks for the pointers and the further reading.
Yes, there is a much more clear separation of concerns now, with the generate()
and generators defining files, and build()
with the helpers just executing them. This way it is also possible to achieve exactly the same build with calling cmake ...
than when calling build()
, which is very important and it was not possible with Conan 1 legacy approach.
True. So far, the API elements seem to have better defined roles than in Conan 1. Congratulations.
Hello,
So, I'm migrating recipes from Conan 1 to Conan 2 and I have code like this that used to work (in
build()
method):However, in Conan 2, I get this error:
Question is: How do I define CMake variables in Conan 2?
thanks,
PC
Have you read the CONTRIBUTING guide?