summaryrefslogtreecommitdiffstats
path: root/Help/command
diff options
context:
space:
mode:
Diffstat (limited to 'Help/command')
-rw-r--r--Help/command/FIND_XXX.txt16
-rw-r--r--Help/command/add_test.rst13
-rw-r--r--Help/command/ctest_coverage.rst2
-rw-r--r--Help/command/ctest_start.rst29
-rw-r--r--Help/command/file.rst273
-rw-r--r--Help/command/find_file.rst9
-rw-r--r--Help/command/find_library.rst9
-rw-r--r--Help/command/find_package.rst21
-rw-r--r--Help/command/find_path.rst9
-rw-r--r--Help/command/find_program.rst3
-rw-r--r--Help/command/if.rst2
-rw-r--r--Help/command/install.rst2
-rw-r--r--Help/command/message.rst5
-rw-r--r--Help/command/string.rst175
14 files changed, 441 insertions, 127 deletions
diff --git a/Help/command/FIND_XXX.txt b/Help/command/FIND_XXX.txt
index dde4dbb..40f1c1a 100644
--- a/Help/command/FIND_XXX.txt
+++ b/Help/command/FIND_XXX.txt
@@ -89,7 +89,8 @@ If ``NO_DEFAULT_PATH`` is not specified, the search process is as follows:
searched after paths from the current module,
i.e. ``<CurrentPackage>_ROOT``, ``ENV{<CurrentPackage>_ROOT}``,
``<ParentPackage>_ROOT``, ``ENV{<ParentPackage>_ROOT}``, etc.
- This can be skipped if ``NO_PACKAGE_ROOT_PATH`` is passed.
+ This can be skipped if ``NO_PACKAGE_ROOT_PATH`` is passed or by setting
+ the :variable:`CMAKE_FIND_USE_PACKAGE_ROOT_PATH` to ``FALSE``.
See policy :policy:`CMP0074`.
* |FIND_PACKAGE_ROOT_PREFIX_PATH_XXX|
@@ -97,7 +98,8 @@ If ``NO_DEFAULT_PATH`` is not specified, the search process is as follows:
2. Search paths specified in cmake-specific cache variables.
These are intended to be used on the command line with a ``-DVAR=value``.
The values are interpreted as :ref:`semicolon-separated lists <CMake Language Lists>`.
- This can be skipped if ``NO_CMAKE_PATH`` is passed.
+ This can be skipped if ``NO_CMAKE_PATH`` is passed or by setting the
+ :variable:`CMAKE_FIND_USE_CMAKE_PATH` to ``FALSE``.
* |CMAKE_PREFIX_PATH_XXX|
* |CMAKE_XXX_PATH|
@@ -107,7 +109,8 @@ If ``NO_DEFAULT_PATH`` is not specified, the search process is as follows:
These are intended to be set in the user's shell configuration,
and therefore use the host's native path separator
(``;`` on Windows and ``:`` on UNIX).
- This can be skipped if ``NO_CMAKE_ENVIRONMENT_PATH`` is passed.
+ This can be skipped if ``NO_CMAKE_ENVIRONMENT_PATH`` is passed or
+ by setting the :variable:`CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH` to ``FALSE``.
* |CMAKE_PREFIX_PATH_XXX|
* |CMAKE_XXX_PATH|
@@ -119,13 +122,16 @@ If ``NO_DEFAULT_PATH`` is not specified, the search process is as follows:
Hard-coded guesses should be specified with the ``PATHS`` option.
5. Search the standard system environment variables.
- This can be skipped if ``NO_SYSTEM_ENVIRONMENT_PATH`` is an argument.
+ This can be skipped if ``NO_SYSTEM_ENVIRONMENT_PATH`` is passed or by
+ setting the :variable:`CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH` to ``FALSE``.
* |SYSTEM_ENVIRONMENT_PATH_XXX|
+ * |SYSTEM_ENVIRONMENT_PATH_WINDOWS_XXX|
6. Search cmake variables defined in the Platform files
for the current system. This can be skipped if ``NO_CMAKE_SYSTEM_PATH``
- is passed.
+ is passed or by setting the :variable:`CMAKE_FIND_USE_CMAKE_SYSTEM_PATH`
+ to ``FALSE``.
* |CMAKE_SYSTEM_PREFIX_PATH_XXX|
* |CMAKE_SYSTEM_XXX_PATH|
diff --git a/Help/command/add_test.rst b/Help/command/add_test.rst
index 46b9b63..a77ba37 100644
--- a/Help/command/add_test.rst
+++ b/Help/command/add_test.rst
@@ -7,7 +7,8 @@ Add a test to the project to be run by :manual:`ctest(1)`.
add_test(NAME <name> COMMAND <command> [<arg>...]
[CONFIGURATIONS <config>...]
- [WORKING_DIRECTORY <dir>])
+ [WORKING_DIRECTORY <dir>]
+ [COMMAND_EXPAND_LISTS])
Adds a test called ``<name>``. The test name may not contain spaces,
quotes, or other characters special in CMake syntax. The options are:
@@ -28,12 +29,18 @@ quotes, or other characters special in CMake syntax. The options are:
directory set to the build directory corresponding to the
current source directory.
+``COMMAND_EXPAND_LISTS``
+ Lists in ``COMMAND`` arguments will be expanded, including those
+ created with
+ :manual:`generator expressions <cmake-generator-expressions(7)>`.
+
The given test command is expected to exit with code ``0`` to pass and
non-zero to fail, or vice-versa if the :prop_test:`WILL_FAIL` test
property is set. Any output written to stdout or stderr will be
captured by :manual:`ctest(1)` but does not affect the pass/fail status
-unless the :prop_test:`PASS_REGULAR_EXPRESSION` or
-:prop_test:`FAIL_REGULAR_EXPRESSION` test property is used.
+unless the :prop_test:`PASS_REGULAR_EXPRESSION`,
+:prop_test:`FAIL_REGULAR_EXPRESSION` or
+:prop_test:`SKIP_REGULAR_EXPRESSION` test property is used.
The ``COMMAND`` and ``WORKING_DIRECTORY`` options may use "generator
expressions" with the syntax ``$<...>``. See the
diff --git a/Help/command/ctest_coverage.rst b/Help/command/ctest_coverage.rst
index 8d27b9c..d50f634 100644
--- a/Help/command/ctest_coverage.rst
+++ b/Help/command/ctest_coverage.rst
@@ -8,7 +8,7 @@ Perform the :ref:`CTest Coverage Step` as a :ref:`Dashboard Client`.
ctest_coverage([BUILD <build-dir>] [APPEND]
[LABELS <label>...]
[RETURN_VALUE <result-var>]
- [CAPTURE_CMAKE_ERROR <result-var]
+ [CAPTURE_CMAKE_ERROR <result-var>]
[QUIET]
)
diff --git a/Help/command/ctest_start.rst b/Help/command/ctest_start.rst
index 6db9a48..f0704ac 100644
--- a/Help/command/ctest_start.rst
+++ b/Help/command/ctest_start.rst
@@ -5,9 +5,9 @@ Starts the testing for a given model
::
- ctest_start(<model> [<source> [<binary>]] [TRACK <track>] [QUIET])
+ ctest_start(<model> [<source> [<binary>]] [GROUP <group>] [QUIET])
- ctest_start([<model> [<source> [<binary>]]] [TRACK <track>] APPEND [QUIET])
+ ctest_start([<model> [<source> [<binary>]]] [GROUP <group>] APPEND [QUIET])
Starts the testing for a given model. The command should be called
after the binary directory is initialized.
@@ -26,20 +26,21 @@ The parameters are as follows:
Set the binary directory. If not specified, the value of
:variable:`CTEST_BINARY_DIRECTORY` is used instead.
-``TRACK <track>``
- If ``TRACK`` is used, the submissions will go to the specified track on the
- CDash server. If no ``TRACK`` is specified, the name of the model is used by
- default.
+``GROUP <group>``
+ If ``GROUP`` is used, the submissions will go to the specified group on the
+ CDash server. If no ``GROUP`` is specified, the name of the model is used by
+ default. This replaces the deprecated option ``TRACK``. Despite the name
+ change its behavior is unchanged.
``APPEND``
If ``APPEND`` is used, the existing ``TAG`` is used rather than creating a new
one based on the current time stamp. If you use ``APPEND``, you can omit the
- ``<model>`` and ``TRACK <track>`` parameters, because they will be read from
+ ``<model>`` and ``GROUP <group>`` parameters, because they will be read from
the generated ``TAG`` file. For example:
.. code-block:: cmake
- ctest_start(Experimental TRACK TrackExperimental)
+ ctest_start(Experimental GROUP GroupExperimental)
Later, in another ``ctest -S`` script:
@@ -48,11 +49,11 @@ The parameters are as follows:
ctest_start(APPEND)
When the second script runs ``ctest_start(APPEND)``, it will read the
- ``Experimental`` model and ``TrackExperimental`` track from the ``TAG`` file
+ ``Experimental`` model and ``GroupExperimental`` group from the ``TAG`` file
generated by the first ``ctest_start()`` command. Please note that if you
- call ``ctest_start(APPEND)`` and specify a different model or track than
+ call ``ctest_start(APPEND)`` and specify a different model or group than
in the first ``ctest_start()`` command, a warning will be issued, and the
- new model and track will be used.
+ new model and group will be used.
``QUIET``
If ``QUIET`` is used, CTest will suppress any non-error messages that it
@@ -65,11 +66,11 @@ equivalent:
.. code-block:: cmake
- ctest_start(Experimental path/to/source path/to/binary TRACK SomeTrack QUIET APPEND)
+ ctest_start(Experimental path/to/source path/to/binary GROUP SomeGroup QUIET APPEND)
- ctest_start(TRACK SomeTrack Experimental QUIET path/to/source APPEND path/to/binary)
+ ctest_start(GROUP SomeGroup Experimental QUIET path/to/source APPEND path/to/binary)
- ctest_start(APPEND QUIET Experimental path/to/source TRACK SomeTrack path/to/binary)
+ ctest_start(APPEND QUIET Experimental path/to/source GROUP SomeGroup path/to/binary)
However, for the sake of readability, it is recommended that you order your
parameters in the order listed at the top of this page.
diff --git a/Help/command/file.rst b/Help/command/file.rst
index f99021e..c06451a 100644
--- a/Help/command/file.rst
+++ b/Help/command/file.rst
@@ -13,6 +13,7 @@ Synopsis
file(`STRINGS`_ <filename> <out-var> [...])
file(`\<HASH\> <HASH_>`_ <filename> <out-var>)
file(`TIMESTAMP`_ <filename> <out-var> [...])
+ file(`GET_RUNTIME_DEPENDENCIES`_ [...])
`Writing`_
file({`WRITE`_ | `APPEND`_} <filename> <content>...)
@@ -130,6 +131,273 @@ timestamp variable will be set to the empty string ("").
See the :command:`string(TIMESTAMP)` command for documentation of
the ``<format>`` and ``UTC`` options.
+.. _GET_RUNTIME_DEPENDENCIES:
+
+.. code-block:: cmake
+
+ file(GET_RUNTIME_DEPENDENCIES
+ [RESOLVED_DEPENDENCIES_VAR <deps_var>]
+ [UNRESOLVED_DEPENDENCIES_VAR <unresolved_deps_var>]
+ [CONFLICTING_DEPENDENICES_PREFIX <conflicting_deps_prefix>]
+ [EXECUTABLES [<executable_files>...]]
+ [LIBRARIES [<library_files>...]]
+ [MODULES [<module_files>...]]
+ [DIRECTORIES [<directories>...]]
+ [BUNDLE_EXECUTABLE <bundle_executable_file>]
+ [PRE_INCLUDE_REGEXES [<regexes>...]]
+ [PRE_EXCLUDE_REGEXES [<regexes>...]]
+ [POST_INCLUDE_REGEXES [<regexes>...]]
+ [POST_EXCLUDE_REGEXES [<regexes>...]]
+ )
+
+Recursively get the list of libraries depended on by the given files.
+
+Please note that this sub-command is not intended to be used in project mode.
+Instead, use it in an :command:`install(CODE)` or :command:`install(SCRIPT)`
+block. For example:
+
+.. code-block:: cmake
+
+ install(CODE [[
+ file(GET_RUNTIME_DEPENDENCIES
+ # ...
+ )
+ ]])
+
+The arguments are as follows:
+
+``RESOLVED_DEPENDENCIES_VAR <deps_var>``
+ Name of the variable in which to store the list of resolved dependencies.
+
+``UNRESOLVED_DEPENDENCIES_VAR <unresolved_deps_var>``
+ Name of the variable in which to store the list of unresolved dependencies.
+ If this variable is not specified, and there are any unresolved dependencies,
+ an error is issued.
+
+``CONFLICTING_DEPENDENCIES_PREFIX <conflicting_deps_prefix>``
+ Variable prefix in which to store conflicting dependency information.
+ Dependencies are conflicting if two files with the same name are found in
+ two different directories. The list of filenames that conflict are stored in
+ ``<conflicting_deps_prefix>_FILENAMES``. For each filename, the list of paths
+ that were found for that filename are stored in
+ ``<conflicting_deps_prefix>_<filename>``.
+
+``EXECUTABLES <executable_files>``
+ List of executable files to read for dependencies. These are executables that
+ are typically created with :command:`add_executable`, but they do not have to
+ be created by CMake. On Apple platforms, the paths to these files determine
+ the value of ``@executable_path`` when recursively resolving the libraries.
+ Specifying ``STATIC`` libraries, ``MODULE`` s, or ``SHARED`` libraries here
+ will result in undefined behavior.
+
+``LIBRARIES <library_files>``
+ List of library files to read for dependencies. These are libraries that are
+ typically created with :command:`add_library(SHARED)`, but they do not have
+ to be created by CMake. Specifying ``STATIC`` libraries, ``MODULE`` s, or
+ executables here will result in undefined behavior.
+
+``MODULES <module_files>``
+ List of loadable module files to read for dependencies. These are modules
+ that are typically created with :command:`add_library(MODULE)`, but they do
+ not have to be created by CMake. They are typically used by calling
+ ``dlopen()`` at runtime rather than linked at link time with ``ld -l``.
+ Specifying ``STATIC`` libraries, ``SHARED`` libraries, or executables here
+ will result in undefined behavior.
+
+``DIRECTORIES <directories>``
+ List of additional directories to search for dependencies. On Linux
+ platforms, these directories are searched if the dependency is not found in
+ any of the other usual paths. If it is found in such a directory, a warning
+ is issued, because it means that the file is incomplete (it does not list all
+ of the directories that contain its dependencies.) On Windows platforms,
+ these directories are searched if the dependency is not found in any of the
+ other search paths, but no warning is issued, because searching other paths
+ is a normal part of Windows dependency resolution. On Apple platforms, this
+ argument has no effect.
+
+``BUNDLE_EXECTUBLE <bundle_executable_file>``
+ Executable to treat as the "bundle executable" when resolving libraries. On
+ Apple platforms, this argument determines the value of ``@executable_path``
+ when recursively resolving libraries for ``LIBRARIES`` and ``MODULES`` files.
+ It has no effect on ``EXECUTABLES`` files. On other platforms, it has no
+ effect. This is typically (but not always) one of the executables in the
+ ``EXECUTABLES`` argument which designates the "main" executable of the
+ package.
+
+The following arguments specify filters for including or excluding libraries to
+be resolved. See below for a full description of how they work.
+
+``PRE_INCLUDE_REGEXES <regexes>``
+ List of pre-include regexes through which to filter the names of
+ not-yet-resolved dependencies.
+
+``PRE_EXCLUDE_REGEXES <regexes>``
+ List of pre-exclude regexes through which to filter the names of
+ not-yet-resolved dependencies.
+
+``POST_INCLUDE_REGEXES <regexes>``
+ List of post-include regexes through which to filter the names of resolved
+ dependencies.
+
+``POST_EXCLUDE_REGEXES <regexes>``
+ List of post-exclude regexes through which to filter the names of resolved
+ dependencies.
+
+These arguments can be used to blacklist unwanted system libraries when
+resolving the dependencies, or to whitelist libraries from a specific
+directory. The filtering works as follows:
+
+1. If the not-yet-resolved dependency matches any of the
+ ``PRE_INCLUDE_REGEXES``, steps 2 and 3 are skipped, and the dependency
+ resolution proceeds to step 4.
+2. If the not-yet-resolved dependency matches any of the
+ ``PRE_EXCLUDE_REGEXES``, dependency resolution stops for that dependency.
+3. Otherwise, dependency resolution proceeds.
+4. ``file(GET_RUNTIME_DEPENDENCIES)`` searches for the dependency according to
+ the linking rules of the platform (see below).
+5. If the dependency is found, and its full path matches one of the
+ ``POST_INCLUDE_REGEXES``, the full path is added to the resolved
+ dependencies, and ``file(GET_RUNTIME_DEPENDENCIES)`` recursively resolves
+ that library's own dependencies. Otherwise, resolution proceeds to step 6.
+6. If the dependency is found, but its full path matches one of the
+ ``POST_EXCLUDE_REGEXES``, it is not added to the resolved dependencies, and
+ dependency resolution stops for that dependency.
+7. If the dependency is found, and its full path does not match either
+ ``POST_INCLUDE_REGEXES`` or ``POST_EXCLUDE_REGEXES``, the full path is added
+ to the resolved dependencies, and ``file(GET_RUNTIME_DEPENDENCIES)``
+ recursively resolves that library's own dependencies.
+
+Different platforms have different rules for how dependencies are resolved.
+These specifics are described here.
+
+On Linux platforms, library resolution works as follows:
+
+1. If the depending file does not have any ``RUNPATH`` entries, and the library
+ exists in one of the depending file's ``RPATH`` entries, or its parents', in
+ that order, the dependency is resolved to that file.
+2. Otherwise, if the depending file has any ``RUNPATH`` entries, and the
+ library exists in one of those entries, the dependency is resolved to that
+ file.
+3. Otherwise, if the library exists in one of the directories listed by
+ ``ldconfig``, the dependency is resolved to that file.
+4. Otherwise, if the library exists in one of the ``DIRECTORIES`` entries, the
+ dependency is resolved to that file. In this case, a warning is issued,
+ because finding a file in one of the ``DIRECTORIES`` means that the
+ depending file is not complete (it does not list all the directories from
+ which it pulls dependencies.)
+5. Otherwise, the dependency is unresolved.
+
+On Windows platforms, library resolution works as follows:
+
+1. The dependent DLL name is converted to lowercase. Windows DLL names are
+ case-insensitive, and some linkers mangle the case of the DLL dependency
+ names. However, this makes it more difficult for ``PRE_INCLUDE_REGEXES``,
+ ``PRE_EXCLUDE_REGEXES``, ``POST_INCLUDE_REGEXES``, and
+ ``POST_EXCLUDE_REGEXES`` to properly filter DLL names - every regex would
+ have to check for both uppercase and lowercase letters. For example:
+
+ .. code-block:: cmake
+
+ file(GET_RUNTIME_DEPENDENCIES
+ # ...
+ PRE_INCLUDE_REGEXES "^[Mm][Yy][Ll][Ii][Bb][Rr][Aa][Rr][Yy]\\.[Dd][Ll][Ll]$"
+ )
+
+ Converting the DLL name to lowercase allows the regexes to only match
+ lowercase names, thus simplifying the regex. For example:
+
+ .. code-block:: cmake
+
+ file(GET_RUNTIME_DEPENDENCIES
+ # ...
+ PRE_INCLUDE_REGEXES "^mylibrary\\.dll$"
+ )
+
+ This regex will match ``mylibrary.dll`` regardless of how it is cased,
+ either on disk or in the depending file. (For example, it will match
+ ``mylibrary.dll``, ``MyLibrary.dll``, and ``MYLIBRARY.DLL``.)
+
+ Please note that the directory portion of any resolved DLLs retains its
+ casing and is not converted to lowercase. Only the filename portion is
+ converted.
+
+2. (**Not yet implemented**) If the depending file is a Windows Store app, and
+ the dependency is listed as a dependency in the application's package
+ manifest, the dependency is resolved to that file.
+3. Otherwise, if the library exists in the same directory as the depending
+ file, the dependency is resolved to that file.
+4. Otherwise, if the library exists in either the operating system's
+ ``system32`` directory or the ``Windows`` directory, in that order, the
+ dependency is resolved to that file.
+5. Otherwise, if the library exists in one of the directories specified by
+ ``DIRECTORIES``, in the order they are listed, the dependency is resolved to
+ that file. (In this case, a warning is not issued, because searching other
+ directories is a normal part of Windows library resolution.)
+6. Otherwise, the dependency is unresolved.
+
+On Apple platforms, library resolution works as follows:
+
+1. If the dependency starts with ``@executable_path/``, and an ``EXECUTABLES``
+ argument is in the process of being resolved, and replacing
+ ``@executable_path/`` with the directory of the executable yields an
+ existing file, the dependency is resolved to that file.
+2. Otherwise, if the dependency starts with ``@executable_path/``, and there is
+ a ``BUNDLE_EXECUTABLE`` argument, and replacing ``@executable_path/`` with
+ the directory of the bundle executable yields an existing file, the
+ dependency is resolved to that file.
+3. Otherwise, if the dependency starts with ``@loader_path/``, and replacing
+ ``@loader_path/`` with the directory of the depending file yields an
+ existing file, the dependency is resolved to that file.
+4. Otherwise, if the dependency starts with ``@rpath/``, and replacing
+ ``@rpath/`` with one of the ``RPATH`` entries of the depending file yields
+ an existing file, the dependency is resolved to that file. (Note that
+ ``RPATH`` entries that start with ``@executable_path/`` or ``@loader_path/``
+ also have these items replaced with the appropriate path.)
+5. Otherwise, if the dependency is an absolute file that exists, the dependency
+ is resolved to that file.
+6. Otherwise, the dependency is unresolved.
+
+This function accepts several variables that determine which tool is used for
+dependency resolution:
+
+.. variable:: CMAKE_GET_RUNTIME_DEPENDENCIES_PLATFORM
+
+ Determines which operating system and executable format the files are built
+ for. This could be one of several values:
+
+ * ``linux+elf``
+ * ``windows+pe``
+ * ``macos+macho``
+
+ If this variable is not specified, it is determined automatically by system
+ introspection.
+
+.. variable:: CMAKE_GET_RUNTIME_DEPENDENCIES_TOOL
+
+ Determines the tool to use for dependency resolution. It could be one of
+ several values, depending on the value of
+ :variable:`CMAKE_GET_RUNTIME_DEPENDENCIES_PLATFORM`:
+
+ ================================================= =============================================
+ ``CMAKE_GET_RUNTIME_DEPENDENCIES_PLATFORM`` ``CMAKE_GET_RUNTIME_DEPENDENCIES_TOOL``
+ ================================================= =============================================
+ ``linux+elf`` ``objdump``
+ ``windows+pe`` ``dumpbin``
+ ``windows+pe`` ``objdump``
+ ``macos+macho`` ``otool``
+ ================================================= =============================================
+
+ If this variable is not specified, it is determined automatically by system
+ introspection.
+
+.. variable:: CMAKE_GET_RUNTIME_DEPENDENCIES_COMMAND
+
+ Determines the path to the tool to use for dependency resolution. This is the
+ actual path to ``objdump``, ``dumpbin``, or ``otool``.
+
+ If this variable is not specified, it is determined automatically by system
+ introspection.
+
Writing
^^^^^^^
@@ -235,6 +503,11 @@ regular expressions, but much simpler. If ``RELATIVE`` flag is
specified, the results will be returned as relative paths to the given
path. The results will be ordered lexicographically.
+On Windows and macOS, globbing is case-insensitive even if the underlying
+filesystem is case-sensitive (both filenames and globbing expressions are
+converted to lowercase before matching). On other platforms, globbing is
+case-sensitive.
+
If the ``CONFIGURE_DEPENDS`` flag is specified, CMake will add logic
to the main build system check target to rerun the flagged ``GLOB`` commands
at build time. If any of the outputs change, CMake will regenerate the build
diff --git a/Help/command/find_file.rst b/Help/command/find_file.rst
index 2a14ad7..3f03f37 100644
--- a/Help/command/find_file.rst
+++ b/Help/command/find_file.rst
@@ -17,11 +17,10 @@ find_file
.. |CMAKE_XXX_PATH| replace:: :variable:`CMAKE_INCLUDE_PATH`
.. |CMAKE_XXX_MAC_PATH| replace:: :variable:`CMAKE_FRAMEWORK_PATH`
-.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: Directories in ``INCLUDE``.
- On Windows hosts:
- ``<prefix>/include/<arch>`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE`
- is set, and |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR|, and the
- directories in ``PATH`` itself.
+.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: The directories in ``PATH`` and ``INCLUDE``.
+.. |SYSTEM_ENVIRONMENT_PATH_WINDOWS_XXX| replace:: On Windows hosts:
+ ``<prefix>/include/<arch>`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE`
+ is set, and |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR|.
.. |CMAKE_SYSTEM_PREFIX_PATH_XXX| replace::
``<prefix>/include/<arch>`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE`
diff --git a/Help/command/find_library.rst b/Help/command/find_library.rst
index 0861d67..8a55aca 100644
--- a/Help/command/find_library.rst
+++ b/Help/command/find_library.rst
@@ -17,11 +17,10 @@ find_library
.. |CMAKE_XXX_PATH| replace:: :variable:`CMAKE_LIBRARY_PATH`
.. |CMAKE_XXX_MAC_PATH| replace:: :variable:`CMAKE_FRAMEWORK_PATH`
-.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: Directories in ``LIB``.
- On Windows hosts:
- ``<prefix>/lib/<arch>`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` is set,
- and |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR|,
- and the directories in ``PATH`` itself.
+.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: The directories in ``PATH`` and ``INCLUDE``.
+.. |SYSTEM_ENVIRONMENT_PATH_WINDOWS_XXX| replace:: On Windows hosts:
+ ``<prefix>/lib/<arch>`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE`
+ is set, and |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR|.
.. |CMAKE_SYSTEM_PREFIX_PATH_XXX| replace::
``<prefix>/lib/<arch>`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` is set,
diff --git a/Help/command/find_package.rst b/Help/command/find_package.rst
index e5e5b2c..2186bd8 100644
--- a/Help/command/find_package.rst
+++ b/Help/command/find_package.rst
@@ -293,13 +293,15 @@ enabled.
The package root variables are maintained as a stack so if
called from within a find module, root paths from the parent's find
module will also be searched after paths for the current package.
- This can be skipped if ``NO_PACKAGE_ROOT_PATH`` is passed.
+ This can be skipped if ``NO_PACKAGE_ROOT_PATH`` is passed or by setting
+ the :variable:`CMAKE_FIND_USE_PACKAGE_ROOT_PATH` to ``FALSE``.
See policy :policy:`CMP0074`.
2. Search paths specified in cmake-specific cache variables. These
are intended to be used on the command line with a ``-DVAR=value``.
The values are interpreted as :ref:`semicolon-separated lists <CMake Language Lists>`.
- This can be skipped if ``NO_CMAKE_PATH`` is passed::
+ This can be skipped if ``NO_CMAKE_PATH`` is passed or by setting the
+ :variable:`CMAKE_FIND_USE_CMAKE_PATH` to ``FALSE``::
CMAKE_PREFIX_PATH
CMAKE_FRAMEWORK_PATH
@@ -309,7 +311,8 @@ enabled.
These are intended to be set in the user's shell configuration,
and therefore use the host's native path separator
(``;`` on Windows and ``:`` on UNIX).
- This can be skipped if ``NO_CMAKE_ENVIRONMENT_PATH`` is passed::
+ This can be skipped if ``NO_CMAKE_ENVIRONMENT_PATH`` is passed or by setting
+ the :variable:`CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH` to ``FALSE``::
<PackageName>_DIR
CMAKE_PREFIX_PATH
@@ -322,7 +325,8 @@ enabled.
be specified with the ``PATHS`` option.
5. Search the standard system environment variables. This can be
- skipped if ``NO_SYSTEM_ENVIRONMENT_PATH`` is passed. Path entries
+ skipped if ``NO_SYSTEM_ENVIRONMENT_PATH`` is passed or by setting the
+ :variable:`CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH` to ``FALSE``. Path entries
ending in ``/bin`` or ``/sbin`` are automatically converted to their
parent directories::
@@ -330,14 +334,17 @@ enabled.
6. Search paths stored in the CMake :ref:`User Package Registry`.
This can be skipped if ``NO_CMAKE_PACKAGE_REGISTRY`` is passed or by
- setting the :variable:`CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY`
- to ``TRUE``.
+ setting the variable :variable:`CMAKE_FIND_USE_PACKAGE_REGISTRY`
+ to ``FALSE`` or the deprecated variable
+ :variable:`CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY` to ``TRUE``.
+
See the :manual:`cmake-packages(7)` manual for details on the user
package registry.
7. Search cmake variables defined in the Platform files for the
current system. This can be skipped if ``NO_CMAKE_SYSTEM_PATH`` is
- passed::
+ passed or by setting the :variable:`CMAKE_FIND_USE_CMAKE_SYSTEM_PATH`
+ to ``FALSE``::
CMAKE_SYSTEM_PREFIX_PATH
CMAKE_SYSTEM_FRAMEWORK_PATH
diff --git a/Help/command/find_path.rst b/Help/command/find_path.rst
index 988a3fa..52ffe3c 100644
--- a/Help/command/find_path.rst
+++ b/Help/command/find_path.rst
@@ -17,11 +17,10 @@ find_path
.. |CMAKE_XXX_PATH| replace:: :variable:`CMAKE_INCLUDE_PATH`
.. |CMAKE_XXX_MAC_PATH| replace:: :variable:`CMAKE_FRAMEWORK_PATH`
-.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: Directories in ``INCLUDE``.
- On Windows hosts:
- ``<prefix>/include/<arch>`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE`
- is set, and |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR|, and the
- directories in ``PATH`` itself.
+.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: The directories in ``PATH`` and ``INCLUDE``.
+.. |SYSTEM_ENVIRONMENT_PATH_WINDOWS_XXX| replace:: On Windows hosts:
+ ``<prefix>/include/<arch>`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE`
+ is set, and |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR|.
.. |CMAKE_SYSTEM_PREFIX_PATH_XXX| replace::
``<prefix>/include/<arch>`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE`
diff --git a/Help/command/find_program.rst b/Help/command/find_program.rst
index 4f00773..e2ff693 100644
--- a/Help/command/find_program.rst
+++ b/Help/command/find_program.rst
@@ -15,7 +15,8 @@ find_program
.. |CMAKE_XXX_PATH| replace:: :variable:`CMAKE_PROGRAM_PATH`
.. |CMAKE_XXX_MAC_PATH| replace:: :variable:`CMAKE_APPBUNDLE_PATH`
-.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: ``PATH``
+.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: The directories in ``PATH`` itself.
+.. |SYSTEM_ENVIRONMENT_PATH_WINDOWS_XXX| replace:: On Windows hosts no extra search paths are included
.. |CMAKE_SYSTEM_PREFIX_PATH_XXX| replace::
|CMAKE_SYSTEM_PREFIX_PATH_XXX_SUBDIR|
diff --git a/Help/command/if.rst b/Help/command/if.rst
index d8e3a45..be992df 100644
--- a/Help/command/if.rst
+++ b/Help/command/if.rst
@@ -29,6 +29,8 @@ If used, it must be a verbatim
repeat of the argument of the opening
``if`` command.
+.. _`Condition Syntax`:
+
Condition Syntax
^^^^^^^^^^^^^^^^
diff --git a/Help/command/install.rst b/Help/command/install.rst
index ab6fef6..5affc5b 100644
--- a/Help/command/install.rst
+++ b/Help/command/install.rst
@@ -126,6 +126,8 @@ project. There are several kinds of target files that may be installed:
marked with the ``FRAMEWORK`` property on macOS (see ``FRAMEWORK``
below.) For DLL platforms (all Windows-based systems including
Cygwin), the DLL import library is treated as an ``ARCHIVE`` target.
+ On AIX, the linker import file created for executables with
+ :prop_tgt:`ENABLE_EXPORTS` is treated as an ``ARCHIVE`` target.
``LIBRARY``
Module libraries are always treated as ``LIBRARY`` targets. For non-
diff --git a/Help/command/message.rst b/Help/command/message.rst
index 5dca6b4..3002842 100644
--- a/Help/command/message.rst
+++ b/Help/command/message.rst
@@ -60,6 +60,11 @@ messages one at a time on a status line and other messages in an
interactive pop-up box. The ``--loglevel`` command-line option to each of
these tools can be used to control which messages will be shown.
+Messages of log levels ``NOTICE`` and below will also have each line preceded
+by the content of the :variable:`CMAKE_MESSAGE_INDENT` variable (converted to
+a single string by concatenating its list items). For ``STATUS`` to ``TRACE``
+messages, this indenting content will be inserted after the hyphens.
+
CMake Warning and Error message text displays using a simple markup
language. Non-indented text is formatted in line-wrapped paragraphs
delimited by newlines. Indented text is considered pre-formatted.
diff --git a/Help/command/string.rst b/Help/command/string.rst
index 2e89d7b..81a2061 100644
--- a/Help/command/string.rst
+++ b/Help/command/string.rst
@@ -22,8 +22,8 @@ Synopsis
string(`PREPEND`_ <string-var> [<input>...])
string(`CONCAT`_ <out-var> [<input>...])
string(`JOIN`_ <glue> <out-var> [<input>...])
- string(`TOLOWER`_ <string1> <out-var>)
- string(`TOUPPER`_ <string1> <out-var>)
+ string(`TOLOWER`_ <string> <out-var>)
+ string(`TOUPPER`_ <string> <out-var>)
string(`LENGTH`_ <string> <out-var>)
string(`SUBSTRING`_ <string> <begin> <length> <out-var>)
string(`STRIP`_ <string> <out-var>)
@@ -38,7 +38,7 @@ Synopsis
`Generation`_
string(`ASCII`_ <number>... <out-var>)
- string(`CONFIGURE`_ <string1> <out-var> [...])
+ string(`CONFIGURE`_ <string> <out-var> [...])
string(`MAKE_C_IDENTIFIER`_ <string> <out-var>)
string(`RANDOM`_ [<option>...] <out-var>)
string(`TIMESTAMP`_ <out-var> [<format string>] [UTC])
@@ -51,23 +51,28 @@ Search and Replace
.. code-block:: cmake
- string(FIND <string> <substring> <output variable> [REVERSE])
+ string(FIND <string> <substring> <output_variable> [REVERSE])
-Return the position where the given substring was found in
-the supplied string. If the ``REVERSE`` flag was used, the command will
+Return the position where the given ``<substring>`` was found in
+the supplied ``<string>``. If the ``REVERSE`` flag was used, the command will
search for the position of the last occurrence of the specified
-substring. If the substring is not found, a position of -1 is returned.
+``<substring>``. If the ``<substring>`` is not found, a position of -1 is
+returned.
+
+The ``string(FIND)`` subcommand treats all strings as ASCII-only characters.
+The index stored in ``<output_variable>`` will also be counted in bytes,
+so strings containing multi-byte characters may lead to unexpected results.
.. _REPLACE:
.. code-block:: cmake
string(REPLACE <match_string>
- <replace_string> <output variable>
+ <replace_string> <output_variable>
<input> [<input>...])
-Replace all occurrences of ``match_string`` in the input
-with ``replace_string`` and store the result in the output.
+Replace all occurrences of ``<match_string>`` in the ``<input>``
+with ``<replace_string>`` and store the result in the ``<output_variable>``.
Regular Expressions
^^^^^^^^^^^^^^^^^^^
@@ -77,9 +82,10 @@ Regular Expressions
.. code-block:: cmake
string(REGEX MATCH <regular_expression>
- <output variable> <input> [<input>...])
+ <output_variable> <input> [<input>...])
-Match the regular expression once and store the match in the output variable.
+Match the ``<regular_expression>`` once and store the match in the
+``<output_variable>``.
All ``<input>`` arguments are concatenated before matching.
.. _`REGEX MATCHALL`:
@@ -87,10 +93,10 @@ All ``<input>`` arguments are concatenated before matching.
.. code-block:: cmake
string(REGEX MATCHALL <regular_expression>
- <output variable> <input> [<input>...])
+ <output_variable> <input> [<input>...])
-Match the regular expression as many times as possible and store the matches
-in the output variable as a list.
+Match the ``<regular_expression>`` as many times as possible and store the
+matches in the ``<output_variable>`` as a list.
All ``<input>`` arguments are concatenated before matching.
.. _`REGEX REPLACE`:
@@ -98,16 +104,17 @@ All ``<input>`` arguments are concatenated before matching.
.. code-block:: cmake
string(REGEX REPLACE <regular_expression>
- <replace_expression> <output variable>
+ <replacement_expression> <output_variable>
<input> [<input>...])
-Match the regular expression as many times as possible and substitute the
-replacement expression for the match in the output.
+Match the ``<regular_expression>`` as many times as possible and substitute
+the ``<replacement_expression>`` for the match in the output.
All ``<input>`` arguments are concatenated before matching.
-The replace expression may refer to paren-delimited subexpressions of the
-match using ``\1``, ``\2``, ..., ``\9``. Note that two backslashes (``\\1``)
-are required in CMake code to get a backslash through argument parsing.
+The ``<replacement_expression>`` may refer to parenthesis-delimited
+subexpressions of the match using ``\1``, ``\2``, ..., ``\9``. Note that
+two backslashes (``\\1``) are required in CMake code to get a backslash
+through argument parsing.
.. _`Regex Specification`:
@@ -180,103 +187,109 @@ Manipulation
.. code-block:: cmake
- string(APPEND <string variable> [<input>...])
+ string(APPEND <string_variable> [<input>...])
-Append all the input arguments to the string.
+Append all the ``<input>`` arguments to the string.
.. _PREPEND:
.. code-block:: cmake
- string(PREPEND <string variable> [<input>...])
+ string(PREPEND <string_variable> [<input>...])
-Prepend all the input arguments to the string.
+Prepend all the ``<input>`` arguments to the string.
.. _CONCAT:
.. code-block:: cmake
- string(CONCAT <output variable> [<input>...])
+ string(CONCAT <output_variable> [<input>...])
-Concatenate all the input arguments together and store
-the result in the named output variable.
+Concatenate all the ``<input>`` arguments together and store
+the result in the named ``<output_variable>``.
.. _JOIN:
.. code-block:: cmake
- string(JOIN <glue> <output variable> [<input>...])
+ string(JOIN <glue> <output_variable> [<input>...])
-Join all the input arguments together using the glue
-string and store the result in the named output variable.
+Join all the ``<input>`` arguments together using the ``<glue>``
+string and store the result in the named ``<output_variable>``.
-To join list's elements, use preferably the ``JOIN`` operator
-from :command:`list` command. This allows for the elements to have
+To join a list's elements, prefer to use the ``JOIN`` operator
+from the :command:`list` command. This allows for the elements to have
special characters like ``;`` in them.
.. _TOLOWER:
.. code-block:: cmake
- string(TOLOWER <string1> <output variable>)
+ string(TOLOWER <string> <output_variable>)
-Convert string to lower characters.
+Convert ``<string>`` to lower characters.
.. _TOUPPER:
.. code-block:: cmake
- string(TOUPPER <string1> <output variable>)
+ string(TOUPPER <string> <output_variable>)
-Convert string to upper characters.
+Convert ``<string>`` to upper characters.
.. _LENGTH:
.. code-block:: cmake
- string(LENGTH <string> <output variable>)
+ string(LENGTH <string> <output_variable>)
-Store in an output variable a given string's length.
+Store in an ``<output_variable>`` a given string's length in bytes.
+Note that this means if ``<string>`` contains multi-byte characters, the
+result stored in ``<output_variable>`` will *not* be the number of characters.
.. _SUBSTRING:
.. code-block:: cmake
- string(SUBSTRING <string> <begin> <length> <output variable>)
+ string(SUBSTRING <string> <begin> <length> <output_variable>)
+
+Store in an ``<output_variable>`` a substring of a given ``<string>``. If
+``<length>`` is ``-1`` the remainder of the string starting at ``<begin>``
+will be returned. If ``<string>`` is shorter than ``<length>`` then the
+end of the string is used instead.
-Store in an output variable a substring of a given string. If length is
-``-1`` the remainder of the string starting at begin will be returned.
-If string is shorter than length then end of string is used instead.
+Both ``<begin>`` and ``<length>`` are counted in bytes, so care must
+be exercised if ``<string>`` could contain multi-byte characters.
.. note::
- CMake 3.1 and below reported an error if length pointed past
- the end of string.
+ CMake 3.1 and below reported an error if ``<length>`` pointed past
+ the end of ``<string>``.
.. _STRIP:
.. code-block:: cmake
- string(STRIP <string> <output variable>)
+ string(STRIP <string> <output_variable>)
-Store in an output variable a substring of a given string with leading and
-trailing spaces removed.
+Store in an ``<output_variable>`` a substring of a given ``<string>`` with
+leading and trailing spaces removed.
.. _GENEX_STRIP:
.. code-block:: cmake
- string(GENEX_STRIP <input string> <output variable>)
+ string(GENEX_STRIP <string> <output_variable>)
Strip any :manual:`generator expressions <cmake-generator-expressions(7)>`
-from the ``input string`` and store the result in the ``output variable``.
+from the input ``<string>`` and store the result in the ``<output_variable>``.
.. _REPEAT:
.. code-block:: cmake
- string(REPEAT <input string> <count> <output variable>)
+ string(REPEAT <string> <count> <output_variable>)
-Produce the output string as repetion of ``input string`` ``count`` times.
+Produce the output string as the input ``<string>`` repeated ``<count>`` times.
Comparison
^^^^^^^^^^
@@ -285,14 +298,14 @@ Comparison
.. code-block:: cmake
- string(COMPARE LESS <string1> <string2> <output variable>)
- string(COMPARE GREATER <string1> <string2> <output variable>)
- string(COMPARE EQUAL <string1> <string2> <output variable>)
- string(COMPARE NOTEQUAL <string1> <string2> <output variable>)
- string(COMPARE LESS_EQUAL <string1> <string2> <output variable>)
- string(COMPARE GREATER_EQUAL <string1> <string2> <output variable>)
+ string(COMPARE LESS <string1> <string2> <output_variable>)
+ string(COMPARE GREATER <string1> <string2> <output_variable>)
+ string(COMPARE EQUAL <string1> <string2> <output_variable>)
+ string(COMPARE NOTEQUAL <string1> <string2> <output_variable>)
+ string(COMPARE LESS_EQUAL <string1> <string2> <output_variable>)
+ string(COMPARE GREATER_EQUAL <string1> <string2> <output_variable>)
-Compare the strings and store true or false in the output variable.
+Compare the strings and store true or false in the ``<output_variable>``.
.. _`Supported Hash Algorithms`:
@@ -303,9 +316,9 @@ Hashing
.. code-block:: cmake
- string(<HASH> <output variable> <input>)
+ string(<HASH> <output_variable> <input>)
-Compute a cryptographic hash of the input string.
+Compute a cryptographic hash of the ``<input>`` string.
The supported ``<HASH>`` algorithm names are:
``MD5``
@@ -336,7 +349,7 @@ Generation
.. code-block:: cmake
- string(ASCII <number> [<number> ...] <output variable>)
+ string(ASCII <number> [<number> ...] <output_variable>)
Convert all numbers into corresponding ASCII characters.
@@ -344,31 +357,31 @@ Convert all numbers into corresponding ASCII characters.
.. code-block:: cmake
- string(CONFIGURE <string1> <output variable>
+ string(CONFIGURE <string> <output_variable>
[@ONLY] [ESCAPE_QUOTES])
-Transform a string like :command:`configure_file` transforms a file.
+Transform a ``<string>`` like :command:`configure_file` transforms a file.
.. _MAKE_C_IDENTIFIER:
.. code-block:: cmake
- string(MAKE_C_IDENTIFIER <input string> <output variable>)
+ string(MAKE_C_IDENTIFIER <string> <output_variable>)
-Convert each non-alphanumeric character in the ``<input string>`` to an
-underscore and store the result in the ``<output variable>``. If the first
-character of the string is a digit, an underscore will also be prepended to
-the result.
+Convert each non-alphanumeric character in the input ``<string>`` to an
+underscore and store the result in the ``<output_variable>``. If the first
+character of the ``<string>`` is a digit, an underscore will also be prepended
+to the result.
.. _RANDOM:
.. code-block:: cmake
string(RANDOM [LENGTH <length>] [ALPHABET <alphabet>]
- [RANDOM_SEED <seed>] <output variable>)
+ [RANDOM_SEED <seed>] <output_variable>)
-Return a random string of given length consisting of
-characters from the given alphabet. Default length is 5 characters
+Return a random string of given ``<length>`` consisting of
+characters from the given ``<alphabet>``. Default length is 5 characters
and default alphabet is all numbers and upper and lower case letters.
If an integer ``RANDOM_SEED`` is given, its value will be used to seed the
random number generator.
@@ -377,18 +390,18 @@ random number generator.
.. code-block:: cmake
- string(TIMESTAMP <output variable> [<format string>] [UTC])
+ string(TIMESTAMP <output_variable> [<format_string>] [UTC])
Write a string representation of the current date
-and/or time to the output variable.
+and/or time to the ``<output_variable>``.
-Should the command be unable to obtain a timestamp the output variable
-will be set to the empty string "".
+If the command is unable to obtain a timestamp, the ``<output_variable>``
+will be set to the empty string ``""``.
The optional ``UTC`` flag requests the current date/time representation to
be in Coordinated Universal Time (UTC) rather than local time.
-The optional ``<format string>`` may contain the following format
+The optional ``<format_string>`` may contain the following format
specifiers:
::
@@ -415,7 +428,7 @@ specifiers:
Unknown format specifiers will be ignored and copied to the output
as-is.
-If no explicit ``<format string>`` is given it will default to:
+If no explicit ``<format_string>`` is given, it will default to:
::
@@ -432,7 +445,7 @@ If no explicit ``<format string>`` is given it will default to:
.. code-block:: cmake
- string(UUID <output variable> NAMESPACE <namespace> NAME <name>
+ string(UUID <output_variable> NAMESPACE <namespace> NAME <name>
TYPE <MD5|SHA1> [UPPER])
Create a universally unique identifier (aka GUID) as per RFC4122
@@ -441,6 +454,6 @@ based on the hash of the combined values of ``<namespace>``
The hash algorithm can be either ``MD5`` (Version 3 UUID) or
``SHA1`` (Version 5 UUID).
A UUID has the format ``xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx``
-where each `x` represents a lower case hexadecimal character.
-Where required an uppercase representation can be requested
+where each ``x`` represents a lower case hexadecimal character.
+Where required, an uppercase representation can be requested
with the optional ``UPPER`` flag.