summaryrefslogtreecommitdiffstats
path: root/Help/command/if.rst
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-07-26 13:21:35 (GMT)
committerKitware Robot <kwrobot@kitware.com>2022-07-26 13:22:29 (GMT)
commit41597025f9f6da2346c10f76622e2d4f27149b69 (patch)
treed12c468d4d59adea5688f7b0a0a983ae88098750 /Help/command/if.rst
parenta2f2090fdc7545bb6abebc38f723749350ce1a87 (diff)
parent37e01773e40c76fbf34d08349e15bff1be2d971e (diff)
downloadCMake-41597025f9f6da2346c10f76622e2d4f27149b69.zip
CMake-41597025f9f6da2346c10f76622e2d4f27149b69.tar.gz
CMake-41597025f9f6da2346c10f76622e2d4f27149b69.tar.bz2
Merge topic 'doc-if-PATH_EQUAL'
37e01773e4 Help: Clarify behavior of path-based equality conditions Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !7503
Diffstat (limited to 'Help/command/if.rst')
-rw-r--r--Help/command/if.rst19
1 files changed, 12 insertions, 7 deletions
diff --git a/Help/command/if.rst b/Help/command/if.rst
index 3908a8c..b72769f 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