mirror of
https://github.com/Kitware/CMake.git
synced 2025-05-09 06:42:18 +08:00
CMakeFindPackageMode: Move documentation to --find-package option
- This moves the CMakeFindPackageMode internal module documentation to the --find-package option as this module itself cannot be used by the project. - Additionally, some links added. - The `QUIET` variable renamed in documentation to `SILENT` to be effective according to the current code.
This commit is contained in:
parent
1c60d83112
commit
e9b86f5618
@ -1389,15 +1389,52 @@ CMake provides a pkg-config like helper for Makefile-based projects:
|
||||
|
||||
cmake --find-package [<options>]
|
||||
|
||||
It searches a package using :command:`find_package()` and prints the
|
||||
resulting flags to stdout. This can be used instead of pkg-config
|
||||
to find installed libraries in plain Makefile-based projects or in
|
||||
autoconf-based projects (via ``share/aclocal/cmake.m4``).
|
||||
|
||||
.. note::
|
||||
This mode is not well-supported due to some technical limitations.
|
||||
It is kept for compatibility but should not be used in new projects.
|
||||
|
||||
.. option:: --find-package
|
||||
|
||||
It searches a package using the :command:`find_package` command and prints the
|
||||
resulting flags to stdout. This can be used instead of pkg-config to find
|
||||
installed libraries in plain Makefile-based projects or in Autoconf-based
|
||||
projects, using auxiliary macros installed in ``share/aclocal/cmake.m4`` on
|
||||
the system.
|
||||
|
||||
When using this option, the following variables are expected:
|
||||
|
||||
``NAME``
|
||||
Name of the package as called in ``find_package(<PackageName>)``.
|
||||
|
||||
``COMPILER_ID``
|
||||
:variable:`Compiler ID <CMAKE_<LANG>_COMPILER_ID>` used for searching the
|
||||
package, i.e. GNU/Intel/Clang/MSVC, etc.
|
||||
|
||||
``LANGUAGE``
|
||||
Language used for searching the package, i.e. C/CXX/Fortran/ASM, etc.
|
||||
|
||||
``MODE``
|
||||
The package search mode. Value can be one of:
|
||||
|
||||
``EXIST``
|
||||
Only checks for existence of the given package.
|
||||
|
||||
``COMPILE``
|
||||
Prints the flags needed for compiling an object file which uses the given
|
||||
package.
|
||||
|
||||
``LINK``
|
||||
Prints the flags needed for linking when using the given package.
|
||||
|
||||
``SILENT``
|
||||
(Optional) If TRUE, find result message is not printed.
|
||||
|
||||
For example:
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
cmake --find-package -DNAME=CURL -DCOMPILER_ID=GNU -DLANGUAGE=C -DMODE=LINK
|
||||
|
||||
.. _`Workflow Mode`:
|
||||
|
||||
Run a Workflow Preset
|
||||
|
@ -10,10 +10,10 @@ values:
|
||||
Running in project mode (processing a ``CMakeLists.txt`` file).
|
||||
|
||||
``SCRIPT``
|
||||
Running in ``-P`` script mode.
|
||||
Running in :ref:`cmake -P <Script Processing Mode>` script mode.
|
||||
|
||||
``FIND_PACKAGE``
|
||||
Running in ``--find-package`` mode.
|
||||
Running in :ref:`cmake --find-package <Find-Package Tool Mode>` mode.
|
||||
|
||||
``CTEST``
|
||||
Running in CTest script mode.
|
||||
|
@ -5,28 +5,15 @@
|
||||
CMakeFindPackageMode
|
||||
--------------------
|
||||
|
||||
This file is executed by cmake when invoked with
|
||||
:ref:`--find-package <Find-Package Tool Mode>`.
|
||||
It expects that the following variables are set using ``-D``:
|
||||
This module is executed by ``cmake`` when invoked with the
|
||||
:ref:`--find-package <Find-Package Tool Mode>` option to locate the requested
|
||||
package.
|
||||
|
||||
``NAME``
|
||||
name of the package
|
||||
``COMPILER_ID``
|
||||
the CMake compiler ID for which the result is,
|
||||
i.e. GNU/Intel/Clang/MSVC, etc.
|
||||
``LANGUAGE``
|
||||
language for which the result will be used,
|
||||
i.e. C/CXX/Fortran/ASM
|
||||
``MODE``
|
||||
``EXIST``
|
||||
only check for existence of the given package
|
||||
``COMPILE``
|
||||
print the flags needed for compiling an object file which uses
|
||||
the given package
|
||||
``LINK``
|
||||
print the flags needed for linking when using the given package
|
||||
``QUIET``
|
||||
if TRUE, don't print anything
|
||||
.. note::
|
||||
|
||||
This is internal module and is not meant to be included directly in the
|
||||
project. For usage details, refer to the :ref:`--find-package
|
||||
<Find-Package Tool Mode>` documentation.
|
||||
#]=======================================================================]
|
||||
|
||||
if(NOT NAME)
|
||||
|
Loading…
x
Reference in New Issue
Block a user