Escaping end of line anker in regex

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Escaping end of line anker in regex

Torsten Robitzki
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

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake

signature.asc (849 bytes) Download Attachment