Skip to content

Commit 5768111

Browse files
czoidodanimtb
authored andcommitted
Explain CONFIG option in CMake find_package (conan-io#1339)
* conan new template (conan-io#1286) * conan new template * added template description * fix code-block * Add detected_os description (conan-io#1276) * Add detected_os description Signed-off-by: Uilian Ries <uilianries@gmail.com> * Update reference/tools.rst Co-Authored-By: Javier G. Sogo <jgsogo@gmail.com> * workpsace yaml list (conan-io#1288) * Adding docs from host-specific proxies (conan-io#1241) * document QNX Neutrino support (conan-io#1290) * - document QNX Neutrino support Signed-off-by: SSE4 <tomskside@gmail.com> * Update integrations/qnx_neutrino.rst Co-Authored-By: Daniel <danimanzaneque@gmail.com> * - update settings.yml Signed-off-by: SSE4 <tomskside@gmail.com> * change default for CMake build_helper (conan-io#1292) * add docs about pre/post_package_info (conan-io#1293) * Add an example of removing system requirements via a wildcard (conan-io#1294) * Add notes about new config global variables CONAN_RETRY and CONAN_RETRY_WAIT (conan-io#1295) * fixed commands help update (Tried linux) * updated conan new --file docs * Deprecated -p in conan upload (conan-io#1300) * Add documentation for tools.to_android_abi (conan-io#1102) * Added missing bits of docs for Android flags (conan-io#1301) * update help messages according to conan/#4896 (conan-io#1285) * cascade policy (conan-io#1296) * Purge 'export-pkg' reference docs (conan-io#1232) * purge 'export-pkg' reference docs * package folder * write a couple of examples! * change workspace by working folder * typos related to formatting * minor fix * Feature/commands help update (conan-io#1299) * Commands help update * Added editable and workspace * Update commands * clarify behavior of package() (conan-io#1304) * conan new jinja template (conan-io#1306) * Add know pip installation issue (conan-io#1311) * Add know pip installation issue * Rephrase * Update installation.rst Co-Authored-By: Javier G. Sogo <jgsogo@gmail.com> * Integrations refactor (conan-io#1308) * Integrations * Rename and fixed link * Fix link * Update integrations/custom.rst Co-Authored-By: Daniel <danimanzaneque@gmail.com> * Update integrations/vcs/git.rst Co-Authored-By: Javier G. Sogo <jgsogo@gmail.com> * Update integrations.rst Co-Authored-By: Javier G. Sogo <jgsogo@gmail.com> * Update integrations/build_system.rst Co-Authored-By: Javier G. Sogo <jgsogo@gmail.com> * Update integrations/cross_platform.rst Co-Authored-By: Daniel <danimanzaneque@gmail.com> * Update integrations/vcs/svn.rst Co-Authored-By: Javier G. Sogo <jgsogo@gmail.com> * Update integrations/linting/binary.rst Co-Authored-By: SSE4 <tomskside@gmail.com> * Msbuild and visual studio, clion update * Same as clion * Redirects * Fixed symlinks * Rewrite of the SCM optimization tip box (conan-io#1307) * Rewrite of the SCM optimization tip box * review * Update creating_packages/package_repo.rst Co-Authored-By: Javier G. Sogo <jgsogo@gmail.com> * update docs to reflect conan new --template arg * update help commands (conan-io#1315) * update help * update equal sign * Conan Extension for Visual Studio (conan-io#1312) * lines about VS extension after conan-io#1308 * Apply suggestions from code review Co-Authored-By: Daniel <danimanzaneque@gmail.com> * Add apple-clang 11 to settings.yml (conan-io#1327) Signed-off-by: Uilian Ries <uilianries@gmail.com> * add example with just one reference with further info using tuples (conan-io#1332) * --package argument deprecation (conan-io#1317) * Note about using only forward slashes for PROFILE_DIR variable (conan-io#1333) * note about using only forward slashes * it is the path to directory, not to the file * typo * explain CONFIG option in CMake find_package * sync with master * Update integrations/build_system/cmake/cmake_find_package_multi_generator.rst Co-Authored-By: Daniel <danimanzaneque@gmail.com> * Update integrations/build_system/cmake/cmake_find_package_multi_generator.rst Co-Authored-By: Daniel <danimanzaneque@gmail.com> * change from note to important
1 parent 453ce40 commit 5768111

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

integrations/build_system/cmake/cmake_find_package_multi_generator.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,13 @@ Usage
2727
$ conan install . -g cmake_find_package_multi -s build_type=Release
2828
2929
These commands will generate several files for each dependency in your graph, including a ``XXXConfig.cmake`` that can be located
30-
by the CMake `find_package(XXX) <https://cmake.org/cmake/help/v3.0/command/find_package.html>`_ command, with XXX as the package name.
30+
by the CMake `find_package(XXX CONFIG) <https://cmake.org/cmake/help/v3.0/command/find_package.html>`_ command, with XXX as the package name.
31+
32+
.. important::
33+
34+
Add the ``CONFIG`` option to ``find_package`` so that *module mode* is explicitly skipped by CMake. This helps to
35+
solve issues when there is for example a ``FindXXXX.cmake`` file in CMake's default modules directory that could be loaded instead of the
36+
``XXXXConfig.cmake`` generated by Conan.
3137

3238
The name of the files follows the pattern ``<package_name>Config.cmake``. So for the ``zlib/1.2.11@conan/stable`` package,
3339
a ``zlibConfig.cmake`` file will be generated.

reference/generators/cmake_find_package_multi.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,13 @@ is declared like this:
5959
6060
The targets are also transitive. So, if your project depends on a packages ``A`` and ``B``, and at the same time
6161
``A`` depends on ``C``, the ``A`` target will contain automatically the properties of the ``C`` dependency, so
62-
in your `CMakeLists.txt` file you only need to ``find_package(A)`` and ``find_package(B)``.
62+
in your `CMakeLists.txt` file you only need to ``find_package(A CONFIG)`` and ``find_package(B CONFIG)``.
63+
64+
.. important::
65+
66+
Add the ``CONFIG`` option to ``find_package`` so that *module mode* is explicitly skipped by CMake.
67+
This helps to solve issues when there is for example a ``FindXXXX.cmake`` file in CMake's default modules directory
68+
that could be loaded instead of the ``XXXXConfig.cmake`` generated by Conan.
6369

6470
You also need to adjust `CMAKE_PREFIX_PATH <https://cmake.org/cmake/help/v3.0/variable/CMAKE_PREFIX_PATH.html>`_ and
6571
`CMAKE_MODULE_PATH <https://cmake.org/cmake/help/v3.0/variable/CMAKE_MODULE_PATH.html>`_ so CMake can locate all

0 commit comments

Comments
 (0)