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
+2-88Lines changed: 2 additions & 88 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,95 +11,9 @@ Conan version (sometimes recommended running from the ``develop2`` source branch
11
11
New CMakeConfigDeps generator
12
12
-----------------------------
13
13
14
-
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
+
This generator is not incubating anymore, but already generally available.
15
+
See :ref:`CMakeConfigDeps generator<conan_tools_cmakeconfigdeps>`
15
16
16
-
- Creates real SHARED/STATIC/INTERFACE IMPORTED targets, no more artificial interface targets. The ``CONAN_LIB::`` and other similar targets do not exist anymore.
17
-
- Defines IMPORTED_CONFIGURATIONS for targets.
18
-
- CONFIG definition of dependencies matching the dependency ``Release/Debug/etc`` ``build_type``, no longer using the consumer one.
19
-
- Definition of IMPORTED_LOCATION and IMPORTED_IMPLIB for library targets.
20
-
- Definition of LINK_LANGUAGES based on the recipe ``languages`` and ``cpp_info/component`` ``languages`` properties.
21
-
- All these allows better propagation of linkage requirement and visibility, avoiding some linkage error of transitive shared libraries in Linux.
22
-
- Better definition of ``requires`` relationships across components inside the same package and with respect to other packages.
23
-
- It doesn't need any ``build_context_activated`` or ``build_context_suffix`` to use ``tool_requires`` dependencies.
24
-
- Definition of ``cpp_info/component.exe`` information (should include the ``.location`` definition too), to define EXECUTABLE targets that can be run.
25
-
- 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.
26
-
- 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.
27
-
- (new since Conan 2.14) Better management of the system OSX Frameworks through ``cpp_info.frameworks``.
28
-
- (new since Conan 2.14) Definition of ``cpp_info/component.package_framework`` information (should include the ``.location`` definition too,
29
-
e.g., ``os.path.join(self.package_folder, "MyFramework.framework", "MyFramework")``) to define the custom OSX Framework library to be linked against.
30
-
31
-
.. note::
32
-
33
-
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.
34
-
Use the ``CMakeDeps`` generator for that.
35
-
36
-
37
-
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:
38
-
39
-
.. code-block:: python
40
-
41
-
# EXPERIMENTAL FIELDS, used exclusively by new CMakeConfigDeps (-c tools.cmake.cmakedeps:new)
42
-
self.cpp_info.type # The type of this artifact "shared-library", "static-library", etc (same as package_type)
43
-
self.cpp_info.location # full location (path and filename with extension) of the artifact or the Apple Framework library one
44
-
self.cpp_info.link_location # Location of the import library for Windows .lib associated to a dll
45
-
self.cpp_info.languages # same as "languages" attribute, it can be "C", "C++"
46
-
self.cpp_info.exe # Definition of an executable artifact
47
-
self.cpp_info.package_framework # Definition of an Apple Framework (new since Conan 2.14)
48
-
self.cpp_info.sources # List of paths to source files in the package (for packages that provide source code to consumers)
49
-
50
-
51
-
These fields will be auto-deduced from the other ``cpp_info`` and ``components`` definitions, like the ``libs`` or ``libdirs`` fields, but the automatic deduction might have limitations. Defining them explicitly will inhibit the auto deduction and use the value as provided by the recipe.
This allows packages to provide source code as a dependency to consumers. The paths should be relative to the package folder.
60
-
The source files will be added as `INTERFACE_SOURCES` property to the CMake library (or component) target and consumers that
61
-
link with this target will compile the sources when building their own targets.
62
-
63
-
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.
64
-
65
-
This new generator will also be usable in ``conanfile`` files with:
66
-
67
-
.. code-block::
68
-
:caption: conanfile.txt
69
-
70
-
[generators]
71
-
CMakeConfigDeps
72
-
73
-
.. code-block:: python
74
-
:caption: conanfile.py
75
-
76
-
classPkg(ConanFile):
77
-
generators ="CMakeConfigDeps"
78
-
79
-
Or:
80
-
81
-
.. code-block:: python
82
-
:caption: conanfile.py
83
-
84
-
from conan import ConanFile
85
-
from conan.tools.cmake import CMakeConfigDeps
86
-
87
-
classTestConan(ConanFile):
88
-
89
-
defgenerate(self):
90
-
deps = CMakeConfigDeps(self)
91
-
deps.generate()
92
-
93
-
94
-
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.
95
-
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
96
-
replacement of existing ``CMakeDeps`` by the ``CMakeConfigDeps``.
97
-
98
-
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.
99
-
100
-
For any feedback, please open new tickets in https://github.com/conan-io/conan/issues.
101
-
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
0 commit comments