install(DIRECTORY): Add EXCLUDE_EMPTY_DIRECTORIES option

EXCLUDE_EMPTY_DIRECTORIES option excludes empty directories under the
directory to install. A directory is considered not empty if and only if
the directory contains at least one file or one symbolic link or one
none-empty sub-directory.

Closes: #19189
This commit is contained in:
Hao Dong
2025-04-20 11:17:19 +08:00
committed by Brad King
parent 2a4c5923ef
commit b70ef48b27
11 changed files with 130 additions and 0 deletions
+8
View File
@@ -648,6 +648,7 @@ Signatures
[USE_SOURCE_PERMISSIONS] [OPTIONAL] [MESSAGE_NEVER]
[CONFIGURATIONS <config>...]
[COMPONENT <component>] [EXCLUDE_FROM_ALL]
[EXCLUDE_EMPTY_DIRECTORIES]
[FILES_MATCHING]
[<match-rule> <match-option>...]...
)
@@ -750,6 +751,13 @@ Signatures
Disable file installation status output.
``EXCLUDE_EMPTY_DIRECTORIES``
.. versionadded:: 4.1
Exclude empty directories from installation. A directory is
considered empty if it contains no files, no symbolic links,
and no non-empty subdirectories.
``FILES_MATCHING``
This option may be given before the first ``<match-rule>`` to
disable installation of files (but not directories) not matched