diff options
author | Brad King <brad.king@kitware.com> | 2022-07-26 13:21:35 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2022-07-26 13:22:28 (GMT) |
commit | d4336c9c9938c6d60380f69a58e4776e79bd3c77 (patch) | |
tree | cf5352f526384b45da77842d364cb68edf606024 /Help | |
parent | aa0a7c3c4a37906f7671cc7937102a3489f40a9e (diff) | |
parent | 37e01773e40c76fbf34d08349e15bff1be2d971e (diff) | |
download | CMake-d4336c9c9938c6d60380f69a58e4776e79bd3c77.zip CMake-d4336c9c9938c6d60380f69a58e4776e79bd3c77.tar.gz CMake-d4336c9c9938c6d60380f69a58e4776e79bd3c77.tar.bz2 |
Merge topic 'doc-if-PATH_EQUAL' into release-3.24
37e01773e4 Help: Clarify behavior of path-based equality conditions
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7503
Diffstat (limited to 'Help')
-rw-r--r-- | Help/command/cmake_path.rst | 5 | ||||
-rw-r--r-- | Help/command/if.rst | 19 |
2 files changed, 15 insertions, 9 deletions
diff --git a/Help/command/cmake_path.rst b/Help/command/cmake_path.rst index 6fd3cf6..eb7da07 100644 --- a/Help/command/cmake_path.rst +++ b/Help/command/cmake_path.rst @@ -482,8 +482,9 @@ are :ref:`normalized <Normalization>` before the check. cmake_path(COMPARE <input1> NOT_EQUAL <input2> <out-var>) Compares the lexical representations of two paths provided as string literals. -No normalization is performed on either path. Equality is determined -according to the following pseudo-code logic: +No normalization is performed on either path, except multiple consecutive +directory separators are effectively collapsed into a single separator. +Equality is determined according to the following pseudo-code logic: :: diff --git a/Help/command/if.rst b/Help/command/if.rst index c096725..301cdce 100644 --- a/Help/command/if.rst +++ b/Help/command/if.rst @@ -320,13 +320,18 @@ Path Comparisons .. _PATH_EQUAL: ``if(<variable|string> PATH_EQUAL <variable|string>)`` - .. versionadded:: 3.24 - Compares the lexical representations of two paths provided as string - literals or variables. No normalization is performed on either path. - - Lexical comparison has the advantage over string comparison to have a - knowledge of the structure of the path. So, the following comparison is - ``TRUE`` using ``PATH_EQUAL`` operator, but ``FALSE`` with ``STREQUAL``: + .. versionadded:: 3.24 + + Compares the two paths component-by-component. Only if every component of + both paths match will the two paths compare equal. Multiple path separators + are effectively collapsed into a single separator, but note that backslashes + are not converted to forward slashes. No other + :ref:`path normalization <Normalization>` is performed. + + Component-wise comparison is superior to string-based comparison due to the + handling of multiple path separators. In the following example, the + expression evaluates to true using ``PATH_EQUAL``, but false with + ``STREQUAL``: .. code-block:: cmake |