mirror of
https://github.com/conan-io/conan-center-index.git
synced 2025-08-13 18:27:10 +00:00
(#13971) docs: when to use CMakeToolchain's variable choices
* docs: when to use CMakeToolchain's variable choices * add example plus fix wording * Update v2_migration.md
This commit is contained in:
@@ -55,6 +55,31 @@ When different build tools are use, at least one layout needs to be set.
|
||||
The `src_folder` must be the same when using different layouts and should
|
||||
not depend on settings or options.
|
||||
|
||||
## CMakeToolchain
|
||||
|
||||
The old `CMake.definition` should be replaced by `CMakeToolchain.variables` and moved to the `generate` method.
|
||||
However, certain options need to be passed as `cache_variables`. You'll need to check project's `CMakeLists.txt`
|
||||
as there are a few cases to look out for:
|
||||
|
||||
- When an `option` is configured before `project()` is called.
|
||||
|
||||
```cmake
|
||||
cmake_minimum_required(3.1)
|
||||
option(BUILD_EXAMPLES "Build examples using foorbar")
|
||||
project(foobar)
|
||||
```
|
||||
|
||||
- When an variable is declared with `CACHE`.
|
||||
|
||||
```cmake
|
||||
cmake_minimum_required(3.1)
|
||||
project(foobar)
|
||||
set(USE_JPEG ON CACHE BOOL "include jpeg support?")
|
||||
```
|
||||
|
||||
For more information refere to the [CMakeToolchain docs](https://docs.conan.io/en/latest/reference/conanfile/tools/cmake/cmaketoolchain.html)
|
||||
or check out the converstaion in conan-io/conan#11937 for the brave.
|
||||
|
||||
## New conf_info properties
|
||||
|
||||
As described in the documentation `self.user_info` has been depreated and you are now required to use
|
||||
|
Reference in New Issue
Block a user