diff options
author | Brad King <brad.king@kitware.com> | 2015-03-20 13:47:52 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2015-03-20 13:47:52 (GMT) |
commit | c95e523db87cd503c97ca2a6021614393bb33e0b (patch) | |
tree | 9d6ecdc8170ba0335c4b0323e38834dc6819f043 /Help | |
parent | f447027307f32b9caa126631faaeab55b7e2133c (diff) | |
parent | 6e54b0b91032d858ae33b3cb093b5e4c9e15970e (diff) | |
download | CMake-c95e523db87cd503c97ca2a6021614393bb33e0b.zip CMake-c95e523db87cd503c97ca2a6021614393bb33e0b.tar.gz CMake-c95e523db87cd503c97ca2a6021614393bb33e0b.tar.bz2 |
Merge topic 'file-globbing-directory-listing'
6e54b0b9 Help: Add notes for topic 'file-globbing-directory-listing'
a2c068a7 file: Teach GLOB to list directories optionally
Diffstat (limited to 'Help')
-rw-r--r-- | Help/command/file.rst | 17 | ||||
-rw-r--r-- | Help/release/dev/file-globbing-directory-listing.rst | 6 |
2 files changed, 20 insertions, 3 deletions
diff --git a/Help/command/file.rst b/Help/command/file.rst index 73d4cfa..2fe7414 100644 --- a/Help/command/file.rst +++ b/Help/command/file.rst @@ -92,9 +92,12 @@ store it in a ``<variable>``. :: - file(GLOB <variable> [RELATIVE <path>] [<globbing-expressions>...]) - file(GLOB_RECURSE <variable> [RELATIVE <path>] - [FOLLOW_SYMLINKS] [<globbing-expressions>...]) + file(GLOB <variable> + [LIST_DIRECTORIES true|false] [RELATIVE <path>] + [<globbing-expressions>...]) + file(GLOB_RECURSE <variable> [FOLLOW_SYMLINKS] + [LIST_DIRECTORIES true|false] [RELATIVE <path>] + [<globbing-expressions>...]) Generate a list of files that match the ``<globbing-expressions>`` and store it into the ``<variable>``. Globbing expressions are similar to @@ -102,6 +105,9 @@ regular expressions, but much simpler. If ``RELATIVE`` flag is specified, the results will be returned as relative paths to the given path. +By default ``GLOB`` lists directories - directories are omited in result if +``LIST_DIRECTORIES`` is set to false. + .. note:: We do not recommend using GLOB to collect a list of source files from your source tree. If no CMakeLists.txt file changes when a source is @@ -119,6 +125,11 @@ matched directory and match the files. Subdirectories that are symlinks are only traversed if ``FOLLOW_SYMLINKS`` is given or policy :policy:`CMP0009` is not set to ``NEW``. +By default ``GLOB_RECURSE`` omits directories from result list - setting +``LIST_DIRECTORIES`` to true adds directories to result list. +If ``FOLLOW_SYMLINKS`` is given or policy :policy:`CMP0009` is not set to +``OLD`` then ``LIST_DIRECTORIES`` treats symlinks as directories. + Examples of recursive globbing include:: /dir/*.py - match all python files in /dir and subdirectories diff --git a/Help/release/dev/file-globbing-directory-listing.rst b/Help/release/dev/file-globbing-directory-listing.rst new file mode 100644 index 0000000..c4d7ba5 --- /dev/null +++ b/Help/release/dev/file-globbing-directory-listing.rst @@ -0,0 +1,6 @@ +file-globbing-directory-listing +------------------------------- + +* The :command:`file(GLOB)` and :command:`file(GLOB_RECURSE)` commands + learned a new ``LIST_DIRECTORIES <bool>`` option to specify whether + the glob result should include directories. |