CMake regex match - Stack Overflow
stackoverflow.com › questions › 52254518Sep 10, 2018 · I have a CMake string variable: set(var "String0 String_1 String_2") I need to select whatever is before the first whitespace from this variable ("String0") and make a new variable with this content. I used CMake's REGEX MATCH method to do this and used this regex: '\S\w*'. I have tested that regex on an online regex interpreter and it worked.
string — CMake 3.23.0-rc3 Documentation
cmake.org › cmake › helpThis means that the regular expression ^ab+d$ matches abbd but not ababd, and the regular expression ^(ab|cd)$ matches ab but not abd. CMake language Escape Sequences such as \t, \r, , and \\ may be used to construct literal tabs, carriage returns, newlines, and backslashes (respectively) to pass in a regex. For example:
string
http://man.hubwiz.com › commandRegular Expressions string(REGEX MATCH <match-regex> <out-var> <input>. ... Note that two backslashes ( \\1 ) are required in CMake code to get a backslash ...