diff --git a/reference/tools/cmake/cmaketoolchain.rst b/reference/tools/cmake/cmaketoolchain.rst index ed5ba97a5f1f..623604f29836 100644 --- a/reference/tools/cmake/cmaketoolchain.rst +++ b/reference/tools/cmake/cmaketoolchain.rst @@ -312,6 +312,24 @@ By default it is ``"conan"``, and it will generate CMake presets named "conan-xx This is done to avoid potential name clashes with users own presets. +absolute_paths +^^^^^^^^^^^^^^ + +By default, ``CMakeToolchain`` will generate relative paths. For example the ``CMakeUserPresets.json`` will have a +relative path to the included ``CMakePresets.json`` (both files generated by ``CMakeToolchain``), and the +``CMakePresets.json`` file will have a relative path to the ``conan_toolchain.cmake`` file defined in its ``toolchainFile`` +field, that will be relative to the build folder, as specified by the CMake presets documentation. + +If for some reason using absolute paths was desired, it is possible to do it with: + +.. code:: python + + def generate(self): + tc = CMakeToolchain(self) + tc.absolute_paths = True + tc.generate() + + Using a custom toolchain file ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^