You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: incubating.rst
+46-7
Original file line number
Diff line number
Diff line change
@@ -7,8 +7,8 @@ Incubating features
7
7
This section is dedicated to new features that are under development, looking for user testing and feedback. They are generally behind a flag to enable them to explicitly opt-in on this testing stage. They require the very latest Conan version (sometimes recommended running from the ``develop2`` source branch), and explicitly setting those flags.
8
8
9
9
10
-
New CMakeDeps generator
11
-
-----------------------
10
+
New CMakeConfigDeps generator
11
+
-----------------------------
12
12
13
13
This generator is designed as a replacement of the current ``CMakeDeps`` generator, with multiple pending fixes and improvements that couldn't easily be done in the current one without breaking:
14
14
@@ -24,11 +24,17 @@ This generator is designed as a replacement of the current ``CMakeDeps`` generat
24
24
- Executables from ``requires`` can also be used in non cross-build scenarios. When a ``tool_requires`` to the same depependency exists, then those executables will have priority.
25
25
- Creation of a new ``conan_cmakedeps_paths.cmake`` that contains definitions of ``<pkg>_DIR`` paths for direct finding of the dependencies. This file is also planned to be used in ``cmake-conan`` to extend its usage and avoid some current limitations due to the fact that a CMake driven installation cannot inject a toolchain later.
26
26
27
+
.. note::
28
+
29
+
This generator is only intended to generate ``config.cmake`` config files, it will not generate ``Find*.cmake`` find modules, and support for it is not planned.
30
+
Use the ``CMakeDeps`` generator for that.
31
+
32
+
27
33
The new fields that can be defined in the ``cpp_info`` or ``cpp_info.components``, besides the already defined in :ref:`CppInfo<conan_conanfile_model_cppinfo>` are:
28
34
29
35
.. code-block:: python
30
36
31
-
# EXPERIMENTAL FIELDS, used exclusively by new CMakeDeps (-c tools.cmake.cmakedeps:new)
37
+
# EXPERIMENTAL FIELDS, used exclusively by new CMakeConfigDeps (-c tools.cmake.cmakedeps:new)
32
38
self.cpp_info.type # The type of this artifact "shared-library", "static-library", etc (same as package_type)
33
39
self.cpp_info.location # full location (path and filename with extension) of the artifact
34
40
self.cpp_info.link_location # Location of the import library for Windows .lib associated to a dll
@@ -40,12 +46,45 @@ These fields will be auto-deduced from the other ``cpp_info`` and ``components``
40
46
41
47
This feature is enabled with the ``-c tools.cmake.cmakedeps:new=will_break_next`` configuration. The value ``will_break_next`` will change in next releases to emphasize the fact that this feature is not suitable for usage beyond testing. Just by enabling this conf and forcing the build of packages that use ``CMakeDeps`` will trigger the usage of the new generator.
42
48
43
-
Known current limitations:
49
+
This new generator will also be usable in ``conanfile`` files with:
44
50
45
-
- At the moment it is limited to ``xxx-config.cmake`` files. It will not generate find modules yet.
46
-
- Some paths in ``conan_cmakedeps_paths.cmake`` might be missing yet, only ``CMAKE_PROGRAM_PATH`` is defined at the moment besides the packages ``<pkg>_DIR`` locations.
51
+
.. code-block::
52
+
:caption: conanfile.txt
53
+
54
+
[generators]
55
+
CMakeConfigDeps
56
+
57
+
.. code-block:: python
58
+
:caption: conanfile.py
59
+
60
+
classPkg(ConanFile):
61
+
generators ="CMakeConfigDeps"
62
+
63
+
Or:
64
+
65
+
.. code-block:: python
66
+
:caption: conanfile.py
67
+
68
+
from conan import ConanFile
69
+
from conan.tools.cmake import CMakeConfigDeps
70
+
71
+
classTestConan(ConanFile):
72
+
73
+
defgenerate(self):
74
+
deps = CMakeConfigDeps(self)
75
+
deps.generate()
76
+
77
+
78
+
The ``-c tools.cmake.cmakedeps:new=will_break_next`` is still necessary for this recipe ``CMakeConfigDeps`` usage, if the config is not enabled, those recipes will fail.
79
+
It is also possible to define ``-c tools.cmake.cmakedeps:new=recipe_will_break`` to enable exclusively the ``CMakeConfigDeps`` generators usages, but not the automatic
80
+
replacement of existing ``CMakeDeps`` by the ``CMakeConfigDeps``.
81
+
82
+
Note that the feature is still "incubating", even for the explicit ``CMakeConfigDeps`` generator syntax, this recipe is subject to break or be removed at any time.
83
+
84
+
For any feedback, please open new tickets in https://github.com/conan-io/conan/issues.
85
+
This feedback is very important to stabilize the feature and get it out of incubating, so even if it worked fine and you found no issue, having the positive feedback
86
+
reported is very useful.
47
87
48
-
For any feedback, please open new tickets in https://github.com/conan-io/conan.
0 commit comments