From d2d2ffe1c1658a47d17df20d4f6b7231609ea9d0 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" Date: Wed, 24 Apr 2024 14:49:20 +0200 Subject: Help: file: document GET_RUNTIME_DEPENDENCIES separately Moved documentation of file(GET_RUNTIME_DEPENDENCIES ...) from the 'Reading' section to a separate section at the bottom of the page. Because it is a very long text, and because this signature is quite different from all the others in the 'Reading' section. --- Help/command/file.rst | 1688 +++++++++++++++++++++++++------------------------ 1 file changed, 847 insertions(+), 841 deletions(-) diff --git a/Help/command/file.rst b/Help/command/file.rst index ee7d05d..ef49faa 100644 --- a/Help/command/file.rst +++ b/Help/command/file.rst @@ -28,7 +28,6 @@ Synopsis file(`STRINGS`_ [...]) file(`\`_ ) file(`TIMESTAMP`_ [...]) - file(`GET_RUNTIME_DEPENDENCIES`_ [...]) `Writing`_ file({`WRITE`_ | `APPEND`_} ...) @@ -65,6 +64,10 @@ Synopsis file(`ARCHIVE_CREATE`_ OUTPUT PATHS ... [...]) file(`ARCHIVE_EXTRACT`_ INPUT [...]) + `Handling Runtime Binaries`_ + file(`GET_RUNTIME_DEPENDENCIES`_ [...]) + + Reading ^^^^^^^ @@ -157,1121 +160,1124 @@ Reading See the :command:`string(TIMESTAMP)` command for documentation of the ```` and ``UTC`` options. +Writing +^^^^^^^ + .. signature:: - file(GET_RUNTIME_DEPENDENCIES [...]) + file(WRITE ...) + file(APPEND ...) - .. versionadded:: 3.16 + Write ```` into a file called ````. If the file does + not exist, it will be created. If the file already exists, ``WRITE`` + mode will overwrite it and ``APPEND`` mode will append to the end. + Any directories in the path specified by ```` that do not + exist will be created. - Recursively get the list of libraries depended on by the given files: + If the file is a build input, use the :command:`configure_file` command + to update the file only when its content changes. - .. code-block:: cmake +.. signature:: + file(TOUCH ...) + file(TOUCH_NOCREATE ...) - file(GET_RUNTIME_DEPENDENCIES - [RESOLVED_DEPENDENCIES_VAR ] - [UNRESOLVED_DEPENDENCIES_VAR ] - [CONFLICTING_DEPENDENCIES_PREFIX ] - [EXECUTABLES ...] - [LIBRARIES ...] - [MODULES ...] - [DIRECTORIES ...] - [BUNDLE_EXECUTABLE ] - [PRE_INCLUDE_REGEXES ...] - [PRE_EXCLUDE_REGEXES ...] - [POST_INCLUDE_REGEXES ...] - [POST_EXCLUDE_REGEXES ...] - [POST_INCLUDE_FILES ...] - [POST_EXCLUDE_FILES ...] - ) + .. versionadded:: 3.12 - Please note that this sub-command is not intended to be used in project mode. - It is intended for use at install time, either from code generated by the - :command:`install(RUNTIME_DEPENDENCY_SET)` command, or from code provided by - the project via :command:`install(CODE)` or :command:`install(SCRIPT)`. - For example: + Create a file with no content if it does not yet exist. If the file already + exists, its access and/or modification will be updated to the time when the + function call is executed. - .. code-block:: cmake + Use ``TOUCH_NOCREATE`` to touch a file if it exists but not create it. + If a file does not exist it will be silently ignored. - install(CODE [[ - file(GET_RUNTIME_DEPENDENCIES - # ... - ) - ]]) + With ``TOUCH`` and ``TOUCH_NOCREATE``, the contents of an existing file + will not be modified. - The arguments are as follows: +.. signature:: + file(GENERATE [...]) - ``RESOLVED_DEPENDENCIES_VAR `` - Name of the variable in which to store the list of resolved dependencies. + Generate an output file for each build configuration supported by the current + :manual:`CMake Generator `. Evaluate + :manual:`generator expressions ` + from the input content to produce the output content. - ``UNRESOLVED_DEPENDENCIES_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. + .. code-block:: cmake - ``CONFLICTING_DEPENDENCIES_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 ``_FILENAMES``. For each filename, the list - of paths that were found for that filename are stored in - ``_``. + file(GENERATE OUTPUT + |CONTENT > + [CONDITION ] [TARGET ] + [NO_SOURCE_PERMISSIONS | USE_SOURCE_PERMISSIONS | + FILE_PERMISSIONS ...] + [NEWLINE_STYLE [UNIX|DOS|WIN32|LF|CRLF] ]) - ``EXECUTABLES ...`` - 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 any kind of library (``STATIC``, - ``MODULE``, or ``SHARED``) here will result in undefined behavior. + The options are: - ``LIBRARIES ...`` - 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`` libraries, or executables here will result in undefined - behavior. + ``CONDITION `` + Generate the output file for a particular configuration only if + the condition is true. The condition must be either ``0`` or ``1`` + after evaluating generator expressions. - ``MODULES ...`` - 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. + ``CONTENT `` + Use the content given explicitly as input. - ``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. + ``INPUT `` + Use the content from a given file as input. - ``BUNDLE_EXECUTABLE `` - 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. + .. versionchanged:: 3.10 + A relative path is treated with respect to the value of + :variable:`CMAKE_CURRENT_SOURCE_DIR`. See policy :policy:`CMP0070`. - The following arguments specify filters for including or excluding libraries - to be resolved. See below for a full description of how they work. + ``OUTPUT `` + Specify the output file name to generate. Use generator expressions + such as :genex:`$` to specify a configuration-specific + output file name. Multiple configurations may generate the same output + file only if the generated content is identical. Otherwise, the + ```` must evaluate to an unique name for each configuration. - ``PRE_INCLUDE_REGEXES ...`` - List of pre-include regexes through which to filter the names of - not-yet-resolved dependencies. + .. versionchanged:: 3.10 + A relative path (after evaluating generator expressions) is treated + with respect to the value of :variable:`CMAKE_CURRENT_BINARY_DIR`. + See policy :policy:`CMP0070`. - ``PRE_EXCLUDE_REGEXES ...`` - List of pre-exclude regexes through which to filter the names of - not-yet-resolved dependencies. + ``TARGET `` + .. versionadded:: 3.19 - ``POST_INCLUDE_REGEXES ...`` - List of post-include regexes through which to filter the names of - resolved dependencies. + Specify which target to use when evaluating generator expressions that + require a target for evaluation (e.g. + :genex:`$`, + :genex:`$`). - ``POST_EXCLUDE_REGEXES ...`` - List of post-exclude regexes through which to filter the names of - resolved dependencies. + ``NO_SOURCE_PERMISSIONS`` + .. versionadded:: 3.20 - ``POST_INCLUDE_FILES ...`` - .. versionadded:: 3.21 + The generated file permissions default to the standard 644 value + (-rw-r--r--). - List of post-include filenames through which to filter the names of - resolved dependencies. Symlinks are resolved when attempting to match - these filenames. + ``USE_SOURCE_PERMISSIONS`` + .. versionadded:: 3.20 - ``POST_EXCLUDE_FILES ...`` - .. versionadded:: 3.21 + Transfer the file permissions of the ``INPUT`` file to the generated + file. This is already the default behavior if none of the three + permissions-related keywords are given (``NO_SOURCE_PERMISSIONS``, + ``USE_SOURCE_PERMISSIONS`` or ``FILE_PERMISSIONS``). The + ``USE_SOURCE_PERMISSIONS`` keyword mostly serves as a way of making + the intended behavior clearer at the call site. It is an error to + specify this option without ``INPUT``. - List of post-exclude filenames through which to filter the names of - resolved dependencies. Symlinks are resolved when attempting to match - these filenames. + ``FILE_PERMISSIONS ...`` + .. versionadded:: 3.20 - These arguments can be used to exclude unwanted system libraries when - resolving the dependencies, or to include libraries from a specific - directory. The filtering works as follows: + Use the specified permissions for the generated file. - 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. + ``NEWLINE_STYLE