Skip to content

Commit

Permalink
Explain CONFIG option in CMake find_package (conan-io#1339)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>

* Update reference/tools.rst

Co-Authored-By: Javier G. Sogo <[email protected]>

* 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 <[email protected]>

* Update integrations/qnx_neutrino.rst

Co-Authored-By: Daniel <[email protected]>

* - update settings.yml

Signed-off-by: SSE4 <[email protected]>

* 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 <[email protected]>

* Integrations refactor (conan-io#1308)

* Integrations

* Rename and fixed link

* Fix link

* Update integrations/custom.rst

Co-Authored-By: Daniel <[email protected]>

* Update integrations/vcs/git.rst

Co-Authored-By: Javier G. Sogo <[email protected]>

* Update integrations.rst

Co-Authored-By: Javier G. Sogo <[email protected]>

* Update integrations/build_system.rst

Co-Authored-By: Javier G. Sogo <[email protected]>

* Update integrations/cross_platform.rst

Co-Authored-By: Daniel <[email protected]>

* Update integrations/vcs/svn.rst

Co-Authored-By: Javier G. Sogo <[email protected]>

* Update integrations/linting/binary.rst

Co-Authored-By: SSE4 <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

* Add apple-clang 11 to settings.yml (conan-io#1327)

Signed-off-by: Uilian Ries <[email protected]>

* 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 <[email protected]>

* Update integrations/build_system/cmake/cmake_find_package_multi_generator.rst

Co-Authored-By: Daniel <[email protected]>

* change from note to important
  • Loading branch information
czoido authored and danimtb committed Jun 27, 2019
1 parent 453ce40 commit 5768111
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@ Usage
$ conan install . -g cmake_find_package_multi -s build_type=Release
These commands will generate several files for each dependency in your graph, including a ``XXXConfig.cmake`` that can be located
by the CMake `find_package(XXX) <https://cmake.org/cmake/help/v3.0/command/find_package.html>`_ command, with XXX as the package name.
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.

.. important::

Add the ``CONFIG`` option to ``find_package`` so that *module mode* is explicitly skipped by CMake. This helps to
solve issues when there is for example a ``FindXXXX.cmake`` file in CMake's default modules directory that could be loaded instead of the
``XXXXConfig.cmake`` generated by Conan.

The name of the files follows the pattern ``<package_name>Config.cmake``. So for the ``zlib/1.2.11@conan/stable`` package,
a ``zlibConfig.cmake`` file will be generated.
Expand Down
8 changes: 7 additions & 1 deletion reference/generators/cmake_find_package_multi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,13 @@ is declared like this:
The targets are also transitive. So, if your project depends on a packages ``A`` and ``B``, and at the same time
``A`` depends on ``C``, the ``A`` target will contain automatically the properties of the ``C`` dependency, so
in your `CMakeLists.txt` file you only need to ``find_package(A)`` and ``find_package(B)``.
in your `CMakeLists.txt` file you only need to ``find_package(A CONFIG)`` and ``find_package(B CONFIG)``.

.. important::

Add the ``CONFIG`` option to ``find_package`` so that *module mode* is explicitly skipped by CMake.
This helps to solve issues when there is for example a ``FindXXXX.cmake`` file in CMake's default modules directory
that could be loaded instead of the ``XXXXConfig.cmake`` generated by Conan.

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

0 comments on commit 5768111

Please sign in to comment.