Is there any way to use (?!...) (the negative-lookahead pattern), and somehow check result in condition?
Or, is there any cross-platform way of running RegEx externally?
(as my reasearch shows, CMake may never support RegExp fully!!)
Example:
I am using CMake version 3.20.5 (current latest stable).
Example of what I tried is below:
if (CMAKE_SYSTEM_PROCESSOR MATCHES "^arm(?!(64))")
message(FATAL_ERROR "Got this far!!")
endif()
And for now, I worked it around like:
if (CMAKE_SYSTEM_PROCESSOR MATCHES "^arm" AND NOT CMAKE_SYSTEM_PROCESSOR MATCHES "^arm64")
# ...
endif()
Error log:
/my-project/CMakeLists.txt:60: error: given arguments: "CMAKE_SYSTEM_PROCESSOR" "MATCHES" "^arm(?!(64))" Regular expression "^arm(?!(64))" cannot compile
My research:
I found the report "CMake Regex does not support lookahead regular expressions" on issue-tracker (which is clone of original report).
With original explanation:
Yeah, that isn't supported.
Adding support would likely mean rewriting the regex engine
(which is old, global variable-driven C code).
It seems, CMake developers are damn lazy (not fixing since 2016-02-09),
and maybe they don't even intend to ever support RegExp fully (because issue-tracker shows "Assignees = None", "Milestone = None", "Labels = None").
Aucun commentaire:
Enregistrer un commentaire