install_data()

Installs files from the source tree that are listed as positional arguments. Please note that this can only install static files from the source tree. Generated files are installed via the install_dir: kwarg on the respective generators, such as custom_target() or configure_file().

See Installing for more examples.

Signature

# Installs files from the source tree that are listed as positional arguments
void install_data(
  file | str file...,  # Files to install

  # Keyword arguments:
  follow_symlinks : bool               # If true, dereferences links and copies their target instead
  install_dir     : str                # The absolute or relative path to the installation directory
  install_mode    : array[str | int]   # specify the file mode in symbolic format and
  install_tag     : str                # A string used by the `meson install --tags` command
  preserve_path   : bool               # Disable stripping child-directories from data files when installing
  rename          : array[str]         # If specified renames each source file into corresponding file from `rename` array
  sources         : array[file | str]  # Additional files to install
)

Arguments

The function accepts between 0 and infinity variadic arguments (file...) of type file | str.

Files to install.

The function install_data() accepts the following keyword arguments:

Name Type Description Tags
install_dir str

The absolute or relative path to the installation directory. If this is a relative path, it is assumed to be relative to the prefix.

If omitted, the directory defaults to {datadir}/{projectname} (since 0.45.0).

install_mode array[str | int]

specify the file mode in symbolic format and optionally the owner/uid and group/gid for the installed files. For example:

install_mode: 'rw-r--r--' for just the file mode

install_mode: ['rw-r--r--', 'nobody', 'nogroup'] for the file mode and the user/group

install_mode: ['rw-r-----', 0, 0] for the file mode and uid/gid

To leave any of these three as the default, specify false.

(since 0.38.0)

install_tag str

A string used by the meson install --tags command to install only a subset of the files. By default these files have no install tag which means they are not being installed when --tags argument is specified.

(since 0.60.0)

preserve_path bool

Disable stripping child-directories from data files when installing.

This is equivalent to GNU Automake's nobase option.

(since 0.64.0)

default = false

rename array[str]

If specified renames each source file into corresponding file from rename array. Nested paths are allowed and they are joined with install_dir. Length of rename array must be equal to the number of sources.

(since 0.46.0)

sources array[file | str]

Additional files to install.

The results of the search are