Skip to content

Commit

Permalink
Clarify Cmaketoolchain user presets documentation (#2591)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcar87 committed Jun 16, 2022
1 parent bdee2c1 commit 8616b5b
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions reference/conanfile/tools/cmake/cmaketoolchain.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Or fully instantiated in the ``generate()`` method:
tc.generate()
This will generate the following files after a ``conan install`` (or when building the package
This will generate the following files after a call to ``conan install`` (or when building the package
in the cache) with the information provided in the ``generate()`` method as well as information
translated from the current ``settings``:

Expand All @@ -64,20 +64,21 @@ translated from the current ``settings``:
- Deactivation of rpaths in OSX

- *CMakePresets.json*: The toolchain also generates a ``CMakePresets.json`` standard file, check the documentation
`here <https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html>`_. It is currently using the version "3" of
`here <https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html>`_. It is currently using version "3" of
the JSON schema.
Conan creates a ``default`` configure preset with the information:
Conan creates a ``default`` configure preset with the following information:

- The ``generator`` to be used.
- The path to the ``conan_toolchain.cmake``
- The CMake ``generator`` to be used.
- The path to the generated ``conan_toolchain.cmake`` file.
- Some cache variables corresponding to the specified settings cannot work if specified in the toolchain.
- The ``CMAKE_BUILD_TYPE`` variable when using a single-configuration generators.

- *CMakeUserPresets.json*: If you declare a ``layout()`` in the recipe and your ``CMakeLists.txt`` file is found at
the ``conanfile.source_folder`` folder, a ``CMakeUserPresets.json`` file will be generated (if doesn't exist already) including
automatically the ``CMakePresets.json`` (at the ``conanfile.generators_folder``) to allow your IDE (Visual Studio,
Visual Studio Code, CLion...) or ``cmake`` tool to locate the ``CMakePresets.json``. The version schema of the generated
``CMakeUserPresets.json`` is "4" and requires CMake >= 3.23.
- The ``CMAKE_BUILD_TYPE`` variable when using single-configuration generators.

- *CMakeUserPresets.json*: If you declare a ``layout()`` in the recipe and your ``CMakeLists.txt`` file is found in
the ``conanfile.source_folder`` folder, Conan will place a ``CMakeUserPresets.json`` to include the ``CMakePresets.json``
generated with the above specification. This will allow your IDE to allow your IDE (Visual Studio, Visual Studio Code, CLion...)
or ``cmake`` tool to locate the Conan-generated``CMakePresets.json``. The version schema of the generated ``CMakeUserPresets.json`` is
"4" and requires CMake >= 3.23.
Note: Conan will skip the generation if it already exists and was not previously generated by Conan.


- *conanvcvars.bat*: In some cases, the Visual Studio environment needs to be defined correctly for building,
Expand Down

0 comments on commit 8616b5b

Please sign in to comment.