Skip to content

Commit

Permalink
Automatic deploy (build number 10)
Browse files Browse the repository at this point in the history
  • Loading branch information
ConanCI bot committed Feb 23, 2024
1 parent 9d2a72e commit 9aacaa8
Show file tree
Hide file tree
Showing 565 changed files with 2,253 additions and 565 deletions.
2 changes: 1 addition & 1 deletion 2.1/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ <h1>Page Not Found<a class="headerlink" href="#page-not-found" title="Link to th

<div role="contentinfo">
<p>&#169; Copyright 2016-2024, JFrog.
<span class="lastupdated">Last updated on Feb 21, 2024.
<span class="lastupdated">Last updated on Feb 23, 2024.
</span></p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion 2.1/Page Not Found.html
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ <h1>Page not found</h1>

<div role="contentinfo">
<p>&#169; Copyright 2016-2024, JFrog.
<span class="lastupdated">Last updated on Feb 21, 2024.
<span class="lastupdated">Last updated on Feb 23, 2024.
</span></p>
</div>

Expand Down
3 changes: 2 additions & 1 deletion 2.1/_sources/examples/tools/cmake/cmake.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ tools.cmake

cmake_toolchain/build_project_cmake_presets
cmake_toolchain/extend_own_cmake_presets
cmake_toolchain/inject_cmake_variables
cmake_toolchain/inject_cmake_variables
cmake_toolchain/use_package_config_cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
.. _examples-tools-cmake-toolchain-use-package-config-cmake:

CMakeToolchain: Using xxx-config.cmake files inside packages
============================================================

Conan relies in the general case in the ``package_info()`` abstraction to allow packages built with any build system
to be usable from any other package built with any other build system. In the CMake case, Conan relies on the
``CMakeDeps`` generator to generate ``xxxx-config.cmake`` files for every dependency, even if those dependencies
didn't generate one or aren't built with CMake at all.

ConanCenter users this abstraction, not packaging the ``xxx-config.cmake`` files, and using the information in ``package_info()``.
This is very important to provide as build-system agnostic as possible packages and be fair with different build systems,
vendors and users. For example, there are many Conan users happily using native MSBuild (VS) projects without any CMake at all.
If ConanCenter packages were only built using the in-package ``config.cmake`` files, this wouldn't be possible.

But the fact that ConanCenter does that, doesn't mean that this is not possible or mandatory. It is perfectly possible
to use the in-packages ``xxx-config.cmake`` files, dropping the usage of ``CMakeDeps`` generator.


You can find the sources to recreate this example in the `examples2 repository
<https://github.com/conan-io/examples2>`_ in GitHub:

.. code-block:: bash
$ git clone https://github.com/conan-io/examples2.git
$ cd examples2/examples/tools/cmake/pkg_config_files
If we have a look to the ``conanfile.py``:

.. code-block:: python
class pkgRecipe(ConanFile):
name = "pkg"
version = "0.1"
...
def package_info(self):
# No information provided, only the in-package .cmake is used here
# Other build systems or CMake via CMakeDeps will fail
self.cpp_info.builddirs = ["pkg/cmake"]
self.cpp_info.set_property("cmake_find_mode", "none")
This is a very typical recipe, the main difference is the ``package_info()`` method. Three important things to notice:

- It doesn't define fields like ``self.cpp_info.libs = ["mypkg"]``. Conan will not be propagating this information to
the consumer, the only place this information will be is inside the in-package ``xxx-config.cmake`` file
- Just in case there are some users still instantiating ``CMakeDeps``, it is disabling the client side generation of the
``xxx-config.cmake`` file with ``set_property("cmake_find_mode", "none")``
- It is defining that it will contain the build scripts (like the ``xxx-config.cmake`` package) inside that folder, to
be located by consumers.

So the responsibility of defining the package details has been transferred to the ``CMakeLists.txt`` that contains:

.. code-block:: cmake
add_library(mylib src/pkg.cpp) # Use a different name than the package, to make sure
set_target_properties(mylib PROPERTIES PUBLIC_HEADER "include/pkg.h")
target_include_directories(mylib PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
# Use non default mypkgConfig name
install(TARGETS mylib EXPORT mypkgConfig)
export(TARGETS mylib
NAMESPACE mypkg:: # to simulate a different name and see it works
FILE "${CMAKE_CURRENT_BINARY_DIR}/mypkgConfig.cmake"
)
install(EXPORT mypkgConfig
DESTINATION "${CMAKE_INSTALL_PREFIX}/pkg/cmake"
NAMESPACE mypkg::
)
With that information, when ``conan create`` is executed:

- The ``build()`` method will build the package
- The ``package()`` method will call ``cmake install``, which will create the ``mypkgConfig.cmake`` file
- It will be created in the package folder ``pkg/cmake/mypkgConfig.cmake`` file
- It will contain enough information for the headers, and it will create a ``mypkg::mylib`` target.

Note that the details of the config filename, the namespace and the target are also not known by Conan,
so this is also something that the consumer build scripts should know.


This is enough to have a package with an internal ``mypkgConfig.cmake`` file that can be used by consumers.
In this example code, the consumer is just the ``test_package/conanfile.py``, but exactly the same wouldn
apply to any arbitrary consumer.

The consumer ``conanfile.py`` doesn't need to use ``CMakeDeps`` at all, only ``generators = "CMakeToolchain"``.
Note that the ``CMakeToolchain`` generator is still necessary, because the ``mypkgConfig.cmake`` needs to
be found inside the Conan cache. The ``CMakeToolchain`` generated ``conan_toolchain.cmake`` file contains
these paths defined.

The consumer ``CMakeLists.txt`` would be standard:

.. code-block:: cmake
find_package(mypkg CONFIG REQUIRED)
add_executable(example src/example.cpp)
target_link_libraries(example mypkg::mylib)
You can verify it works with:

.. code-block:: bash
$ conan create .
======== Testing the package: Executing test ========
pkg/0.1 (test package): Running test()
pkg/0.1 (test package): RUN: Release\example
pkg/0.1: Hello World Release!
pkg/0.1: _M_X64 defined
pkg/0.1: MSVC runtime: MultiThreadedDLL
pkg/0.1: _MSC_VER1939
pkg/0.1: _MSVC_LANG201402
pkg/0.1: __cplusplus199711
pkg/0.1 test_package
Important considerations
------------------------

The presented approach has one limitation, it doesn't work for multi-configuration IDEs.
Implementing this approach won't allow developers to directly switch from IDEs like Visual Studio from Release to Debug
and viceversa, and it will require a ``conan install`` to change. It is not an issue at all for single-config setups,
but for VS developers it can be a bit inconvenient. The team is working on the VS plugin that might help to mitigate this.
The reason is a CMake limitation, ``find_package()`` can only find one configuration, and with ``CMakeDeps`` being dropped
here, there is nothing that Conan can do to avoid this limitation.

It is important to know that it is also the package author and the package ``CMakeLists.txt`` responsibility to correctly
manage transitivity to other dependencies, and this is not trivial in some cases. There are risks that if not done
correctly the in-package ``xxx-config.cmake`` file can locate its transitive dependencies elsewhere, like in the system,
but not in the transtive Conan package dependencies.

Finally, recall that these packages won't be usable by other build systems rather than CMake.
2 changes: 1 addition & 1 deletion 2.1/changelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@ <h2>2.0.0-beta1 (20-Jun-2022)<a class="headerlink" href="#beta1-20-jun-2022" tit

<div role="contentinfo">
<p>&#169; Copyright 2016-2024, JFrog.
<span class="lastupdated">Last updated on Feb 21, 2024.
<span class="lastupdated">Last updated on Feb 23, 2024.
</span></p>
</div>

Expand Down
Binary file modified 2.1/conan.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion 2.1/devops.html
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@

<div role="contentinfo">
<p>&#169; Copyright 2016-2024, JFrog.
<span class="lastupdated">Last updated on Feb 21, 2024.
<span class="lastupdated">Last updated on Feb 23, 2024.
</span></p>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@

<div role="contentinfo">
<p>&#169; Copyright 2016-2024, JFrog.
<span class="lastupdated">Last updated on Feb 21, 2024.
<span class="lastupdated">Last updated on Feb 23, 2024.
</span></p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion 2.1/devops/backup_sources/sources_backup.html
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ <h3>Upload the packages<a class="headerlink" href="#upload-the-packages" title="

<div role="contentinfo">
<p>&#169; Copyright 2016-2024, JFrog.
<span class="lastupdated">Last updated on Feb 21, 2024.
<span class="lastupdated">Last updated on Feb 23, 2024.
</span></p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion 2.1/devops/conancenter/hosting_binaries.html
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ <h2>Updating from upstream<a class="headerlink" href="#updating-from-upstream" t

<div role="contentinfo">
<p>&#169; Copyright 2016-2024, JFrog.
<span class="lastupdated">Last updated on Feb 21, 2024.
<span class="lastupdated">Last updated on Feb 23, 2024.
</span></p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion 2.1/devops/metadata.html
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ <h2>test_package as metadata<a class="headerlink" href="#test-package-as-metadat

<div role="contentinfo">
<p>&#169; Copyright 2016-2024, JFrog.
<span class="lastupdated">Last updated on Feb 21, 2024.
<span class="lastupdated">Last updated on Feb 23, 2024.
</span></p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion 2.1/devops/save_restore.html
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@

<div role="contentinfo">
<p>&#169; Copyright 2016-2024, JFrog.
<span class="lastupdated">Last updated on Feb 21, 2024.
<span class="lastupdated">Last updated on Feb 23, 2024.
</span></p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion 2.1/devops/using_conancenter.html
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ <h2>Control and customization<a class="headerlink" href="#control-and-customizat

<div role="contentinfo">
<p>&#169; Copyright 2016-2024, JFrog.
<span class="lastupdated">Last updated on Feb 21, 2024.
<span class="lastupdated">Last updated on Feb 23, 2024.
</span></p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion 2.1/devops/versioning.html
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@

<div role="contentinfo">
<p>&#169; Copyright 2016-2024, JFrog.
<span class="lastupdated">Last updated on Feb 21, 2024.
<span class="lastupdated">Last updated on Feb 23, 2024.
</span></p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion 2.1/devops/versioning/resolve_prereleases.html
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@

<div role="contentinfo">
<p>&#169; Copyright 2016-2024, JFrog.
<span class="lastupdated">Last updated on Feb 21, 2024.
<span class="lastupdated">Last updated on Feb 23, 2024.
</span></p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion 2.1/examples.html
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@

<div role="contentinfo">
<p>&#169; Copyright 2016-2024, JFrog.
<span class="lastupdated">Last updated on Feb 21, 2024.
<span class="lastupdated">Last updated on Feb 23, 2024.
</span></p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion 2.1/examples/commands.html
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@

<div role="contentinfo">
<p>&#169; Copyright 2016-2024, JFrog.
<span class="lastupdated">Last updated on Feb 21, 2024.
<span class="lastupdated">Last updated on Feb 23, 2024.
</span></p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion 2.1/examples/commands/pkglists.html
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ <h2>Removing packages lists<a class="headerlink" href="#removing-packages-lists"

<div role="contentinfo">
<p>&#169; Copyright 2016-2024, JFrog.
<span class="lastupdated">Last updated on Feb 21, 2024.
<span class="lastupdated">Last updated on Feb 23, 2024.
</span></p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion 2.1/examples/conanfile.html
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@

<div role="contentinfo">
<p>&#169; Copyright 2016-2024, JFrog.
<span class="lastupdated">Last updated on Feb 21, 2024.
<span class="lastupdated">Last updated on Feb 23, 2024.
</span></p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion 2.1/examples/conanfile/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@

<div role="contentinfo">
<p>&#169; Copyright 2016-2024, JFrog.
<span class="lastupdated">Last updated on Feb 21, 2024.
<span class="lastupdated">Last updated on Feb 23, 2024.
</span></p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion 2.1/examples/conanfile/layout/conanfile_in_subfolder.html
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@

<div role="contentinfo">
<p>&#169; Copyright 2016-2024, JFrog.
<span class="lastupdated">Last updated on Feb 21, 2024.
<span class="lastupdated">Last updated on Feb 23, 2024.
</span></p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion 2.1/examples/conanfile/layout/editable_components.html
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@

<div role="contentinfo">
<p>&#169; Copyright 2016-2024, JFrog.
<span class="lastupdated">Last updated on Feb 21, 2024.
<span class="lastupdated">Last updated on Feb 23, 2024.
</span></p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion 2.1/examples/conanfile/layout/multiple_subprojects.html
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@

<div role="contentinfo">
<p>&#169; Copyright 2016-2024, JFrog.
<span class="lastupdated">Last updated on Feb 21, 2024.
<span class="lastupdated">Last updated on Feb 23, 2024.
</span></p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion 2.1/examples/conanfile/layout/third_party_libraries.html
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@

<div role="contentinfo">
<p>&#169; Copyright 2016-2024, JFrog.
<span class="lastupdated">Last updated on Feb 21, 2024.
<span class="lastupdated">Last updated on Feb 23, 2024.
</span></p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion 2.1/examples/conanfile/package_info.html
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@

<div role="contentinfo">
<p>&#169; Copyright 2016-2024, JFrog.
<span class="lastupdated">Last updated on Feb 21, 2024.
<span class="lastupdated">Last updated on Feb 23, 2024.
</span></p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion 2.1/examples/conanfile/package_info/components.html
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@

<div role="contentinfo">
<p>&#169; Copyright 2016-2024, JFrog.
<span class="lastupdated">Last updated on Feb 21, 2024.
<span class="lastupdated">Last updated on Feb 23, 2024.
</span></p>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@

<div role="contentinfo">
<p>&#169; Copyright 2016-2024, JFrog.
<span class="lastupdated">Last updated on Feb 21, 2024.
<span class="lastupdated">Last updated on Feb 23, 2024.
</span></p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion 2.1/examples/config_files.html
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@

<div role="contentinfo">
<p>&#169; Copyright 2016-2024, JFrog.
<span class="lastupdated">Last updated on Feb 21, 2024.
<span class="lastupdated">Last updated on Feb 23, 2024.
</span></p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion 2.1/examples/config_files/settings/settings_user.html
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ <h2>Use your new settings<a class="headerlink" href="#use-your-new-settings" tit

<div role="contentinfo">
<p>&#169; Copyright 2016-2024, JFrog.
<span class="lastupdated">Last updated on Feb 21, 2024.
<span class="lastupdated">Last updated on Feb 23, 2024.
</span></p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion 2.1/examples/cross_build.html
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@

<div role="contentinfo">
<p>&#169; Copyright 2016-2024, JFrog.
<span class="lastupdated">Last updated on Feb 21, 2024.
<span class="lastupdated">Last updated on Feb 23, 2024.
</span></p>
</div>

Expand Down
Loading

0 comments on commit 9aacaa8

Please sign in to comment.