[CMake] Escaping end of line anker in regex

Torsten Robitzki Torsten at Robitzki.de
Thu Jan 10 04:35:13 EST 2019


Hi,
I’ve stumbled over following issue:

if (NOT ^ MATCHES ^\^ )
    message(FATAL_ERROR "Anker not found!")
  endif()

  if (NOT $<foo MATCHES ^\$<)
    message(FATAL_ERROR "Start of generator expression not found!")
  endif()

If run (with version 3.13), this yields:

  $ cmake -P test.cmake
  CMake Error at test.cmake:7 (message):
    Start of generator expression not found!

If I double escape the regex in the second if (^\\$<), then this works as expected. Any idea, why I have to double escape the $-anker? Is this a bug?

Kind regards,

Torsten
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Message signed with OpenPGP
URL: <https://cmake.org/pipermail/cmake/attachments/20190110/f1453083/attachment.sig>


More information about the CMake mailing list