2013-10-15 19:17:36 +04:00
|
|
|
include
|
|
|
|
-------
|
|
|
|
|
|
|
|
Load and run CMake code from a file or module.
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
include(<file|module> [OPTIONAL] [RESULT_VARIABLE <VAR>]
|
|
|
|
[NO_POLICY_SCOPE])
|
|
|
|
|
|
|
|
Load and run CMake code from the file given. Variable reads and
|
2015-06-05 00:51:22 +03:00
|
|
|
writes access the scope of the caller (dynamic scoping). If ``OPTIONAL``
|
2013-10-15 19:17:36 +04:00
|
|
|
is present, then no error is raised if the file does not exist. If
|
2015-06-05 00:51:22 +03:00
|
|
|
``RESULT_VARIABLE`` is given the variable will be set to the full filename
|
2013-10-15 19:17:36 +04:00
|
|
|
which has been included or NOTFOUND if it failed.
|
|
|
|
|
|
|
|
If a module is specified instead of a file, the file with name
|
2016-09-15 21:01:13 +03:00
|
|
|
``<modulename>.cmake`` is searched first in :variable:`CMAKE_MODULE_PATH`,
|
2015-06-05 00:51:22 +03:00
|
|
|
then in the CMake module directory. There is one exception to this: if
|
2016-09-15 21:01:13 +03:00
|
|
|
the file which calls ``include()`` is located itself in the CMake builtin
|
|
|
|
module directory, then first the CMake builtin module directory is searched and
|
2015-06-05 00:51:22 +03:00
|
|
|
:variable:`CMAKE_MODULE_PATH` afterwards. See also policy :policy:`CMP0017`.
|
2013-10-15 19:17:36 +04:00
|
|
|
|
2015-06-05 00:51:22 +03:00
|
|
|
See the :command:`cmake_policy` command documentation for discussion of the
|
|
|
|
``NO_POLICY_SCOPE`` option.
|