summaryrefslogtreecommitdiffstats
path: root/Help/command
diff options
context:
space:
mode:
authorscivision <scivision@users.noreply.github.com>2023-01-23 15:47:54 (GMT)
committerBrad King <brad.king@kitware.com>2023-01-24 19:13:52 (GMT)
commita1dc38a5670939a8ce8dfd99282f86d47412a98a (patch)
tree12f0296080cf6c345901839bc6f134fbd01177d3 /Help/command
parentadac7f3ca41ae38248f62ce48000390143762e99 (diff)
downloadCMake-a1dc38a5670939a8ce8dfd99282f86d47412a98a.zip
CMake-a1dc38a5670939a8ce8dfd99282f86d47412a98a.tar.gz
CMake-a1dc38a5670939a8ce8dfd99282f86d47412a98a.tar.bz2
Help: Document behavior of if(EXISTS,IS_DIRECTORY) for empty paths
Document and add explicit tests for empty string input: `if(EXISTS "")` and `if(IS_DIRECTORY "")` are always false. This avoids need for users to do extra checks due to CMake non-short-circuit logic as below: if("${p}") if(EXISTS "${p}")
Diffstat (limited to 'Help/command')
-rw-r--r--Help/command/if.rst8
1 files changed, 6 insertions, 2 deletions
diff --git a/Help/command/if.rst b/Help/command/if.rst
index a57630b..684c113 100644
--- a/Help/command/if.rst
+++ b/Help/command/if.rst
@@ -165,6 +165,8 @@ File Operations
Resolves symbolic links, i.e. if the named file or directory is a
symbolic link, returns true if the target of the symbolic link exists.
+ False if the given path is an empty string.
+
``if(file1 IS_NEWER_THAN file2)``
True if ``file1`` is newer than ``file2`` or if one of the two files doesn't
exist. Behavior is well-defined only for full paths. If the file
@@ -173,10 +175,12 @@ File Operations
of a tie. This includes the case of passing the same file name for
both file1 and file2.
-``if(IS_DIRECTORY path-to-directory)``
- True if the given name is a directory. Behavior is well-defined only
+``if(IS_DIRECTORY path)``
+ True if ``path`` is a directory. Behavior is well-defined only
for full paths.
+ False if the given path is an empty string.
+
``if(IS_SYMLINK file-name)``
True if the given name is a symbolic link. Behavior is well-defined
only for full paths.