Mickaël Germain
860583ceac
if: Add PATH_IS_PREFIX operator
...
Testing whether one path is a prefix of another is possible today with
cmake_path(IS_PREFIX), but the idiom needs a separate statement plus a
scratch variable and takes the prefix as a variable name, so projects
reach for if(path MATCHES "^${prefix}") instead. That is wrong whenever
the prefix contains a regex metacharacter, and it accepts siblings,
because '^/a/b' matches '/a/bc'.
Add a binary operator where the left operand is the candidate prefix and
the right is the path, matching the operand order of cmake_path(IS_PREFIX)
and $<PATH:IS_PREFIX> so that the same operation reads the same way on all
three surfaces. Neither operand is normalized, matching the default of
cmake_path(IS_PREFIX) and the existing PATH_EQUAL operator, so '.' and
'..' are compared as ordinary components. The test is non-strict, purely
lexical, and applies no relative-to-absolute reconciliation.
Add policy CMP0222 for compatibility, modeled on CMP0139. The keyword
is consumed as an operator only when it appears in the second argument
slot, so a variable named PATH_IS_PREFIX keeps working in unary and
left-operand position. What the policy covers is such a variable
appearing after another token, as in if(NOT PATH_IS_PREFIX AND other),
which becomes a configure error under NEW.
Since the operator is an if() spelling of cmake_path(IS_PREFIX) and shares
its implementation, test it by asserting the two agree over a corpus of
inputs rather than by restating expected values. Those are pinned by the
cmake_path(IS_PREFIX) test, so the operator's tests stay limited to what
has no command equivalent, and no platform branching is needed because
parity holds whatever the host path model answers.
Fixes : #28040
2026-09-10 07:09:47 -04:00
..
2025-11-16 06:07:08 -05:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-06-12 21:25:24 +02:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-05-27 00:16:57 +02:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-29 06:18:15 +02:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-29 06:33:47 +02:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-06-12 21:25:24 +02:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-10-02 13:56:27 -04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-08-11 10:32:40 +02:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2026-06-04 10:14:19 -04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-09-23 11:30:22 -04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-04-14 03:07:46 +04:00
2025-05-30 02:35:45 +02:00
2025-05-03 13:18:19 -04:00
2025-05-21 10:19:58 -07:00
2025-05-28 09:47:06 -04:00
2025-06-05 09:16:54 -04:00
2025-07-15 11:51:45 -04:00
2026-01-12 10:58:08 -05:00
2025-08-20 14:44:05 -04:00
2025-10-01 09:23:32 -04:00
2025-09-25 11:00:39 +02:00
2025-09-29 18:26:44 -04:00
2025-10-07 09:29:32 -04:00
2025-10-31 08:42:59 +03:00
2025-11-08 09:25:08 -05:00
2025-11-14 17:23:26 +03:00
2025-12-09 13:37:01 -05:00
2026-01-16 18:10:14 +11:00
2026-01-31 19:37:09 -05:00
2026-05-28 16:53:01 -04:00
2026-03-23 09:50:46 -04:00
2026-03-24 14:07:21 -04:00
2026-04-17 13:10:24 -04:00
2026-08-13 10:14:16 -04:00
2026-04-28 15:30:44 -04:00
2026-04-29 16:43:04 +02:00
2026-05-12 13:09:30 -04:00
2026-05-31 14:36:15 -04:00
2026-08-07 11:05:57 -04:00
2026-09-02 14:48:36 +02:00
2026-09-10 07:09:47 -04:00