Skip to content

Commit e48820b

Browse files
committed
Remove \r characters from regular expressions
CMake doesn't seem to need this Windows specific newline style as all content read by file() has CRLF converted to simpler LF only.
1 parent 1384fac commit e48820b

File tree

10 files changed

+34
-34
lines changed

10 files changed

+34
-34
lines changed

bin/update-cmake.cmake

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@ string(
3838
"cmake_minimum_required"
3939
"[ \t]*"
4040
"\\("
41-
"[ \t\r\n]*"
41+
"[ \t\n]*"
4242
"VERSION"
43-
"[ \t\r\n]+"
43+
"[ \t\n]+"
4444
"[0-9]\\.[0-9]+[0-9.]*"
4545
"(\\.\\.\\.[0-9]\\.[0-9]+)?"
46-
"[ \t\r\n]*"
46+
"[ \t\n]*"
4747
"(FATAL_ERROR)?"
48-
"[ \t\r\n]*"
48+
"[ \t\n]*"
4949
"\\)"
5050
)
5151

cmake/cmake/modules/FindBerkeleyDB.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,14 @@ block(PROPAGATE BerkeleyDB_VERSION)
124124
STRINGS
125125
${BerkeleyDB_INCLUDE_DIR}/db.h
126126
results
127-
REGEX "^[ \t]*#[ \t]*define[ \t]+DB_VERSION_(MAJOR|MINOR|PATCH)[ \t]+[0-9]+[^\r\n]*$"
127+
REGEX "^[ \t]*#[ \t]*define[ \t]+DB_VERSION_(MAJOR|MINOR|PATCH)[ \t]+[0-9]+[^\n]*$"
128128
)
129129

130130
unset(BerkeleyDB_VERSION)
131131

132132
foreach(item MAJOR MINOR PATCH)
133133
foreach(line ${results})
134-
if(line MATCHES "^[ \t]*#[ \t]*define[ \t]+DB_VERSION_${item}[ \t]+([0-9]+)[^\r\n]*$")
134+
if(line MATCHES "^[ \t]*#[ \t]*define[ \t]+DB_VERSION_${item}[ \t]+([0-9]+)[^\n]*$")
135135
if(DEFINED BerkeleyDB_VERSION)
136136
string(APPEND BerkeleyDB_VERSION ".${CMAKE_MATCH_1}")
137137
else()

cmake/cmake/modules/FindCcache.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ block(PROPAGATE Ccache_VERSION)
4747
OUTPUT_STRIP_TRAILING_WHITESPACE
4848
)
4949

50-
if(version MATCHES "^ccache version ([^\r\n]+)")
50+
if(version MATCHES "^ccache version ([^\n]+)")
5151
set(Ccache_VERSION "${CMAKE_MATCH_1}")
5252
endif()
5353
endif()

cmake/cmake/modules/FindDmalloc.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,14 @@ block(PROPAGATE Dmalloc_VERSION)
5959
${Dmalloc_INCLUDE_DIR}/dmalloc.h
6060
results
6161
REGEX
62-
"^#[ \t]*define[ \t]+DMALLOC_VERSION_(MAJOR|MINOR|PATCH)[ \t]+[0-9]+[ \t]*[^\r\n]*$"
62+
"^#[ \t]*define[ \t]+DMALLOC_VERSION_(MAJOR|MINOR|PATCH)[ \t]+[0-9]+[ \t]*[^\n]*$"
6363
)
6464

6565
unset(Dmalloc_VERSION)
6666

6767
foreach(item MAJOR MINOR PATCH)
6868
foreach(line ${results})
69-
if(line MATCHES "^#[ \t]*define[ \t]+DMALLOC_VERSION_${item}[ \t]+([0-9]+)[ \t]*[^\r\n]*$")
69+
if(line MATCHES "^#[ \t]*define[ \t]+DMALLOC_VERSION_${item}[ \t]+([0-9]+)[ \t]*[^\n]*$")
7070
if(DEFINED Dmalloc_VERSION)
7171
string(APPEND Dmalloc_VERSION ".${CMAKE_MATCH_1}")
7272
else()

cmake/cmake/modules/FindGD.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,14 @@ block(PROPAGATE GD_VERSION)
6868
${GD_INCLUDE_DIR}/gd.h
6969
results
7070
REGEX
71-
"^#[ \t]*define[ \t]+GD_(MAJOR|MINOR|RELEASE)_VERSION[ \t]+[0-9]+[ \t]*[^\r\n]*$"
71+
"^#[ \t]*define[ \t]+GD_(MAJOR|MINOR|RELEASE)_VERSION[ \t]+[0-9]+[ \t]*[^\n]*$"
7272
)
7373

7474
unset(GD_VERSION)
7575

7676
foreach(item MAJOR MINOR RELEASE)
7777
foreach(line ${results})
78-
if(line MATCHES "^#[ \t]*define[ \t]+GD_${item}_VERSION[ \t]+([0-9]+)[ \t]*[^\r\n]*$")
78+
if(line MATCHES "^#[ \t]*define[ \t]+GD_${item}_VERSION[ \t]+([0-9]+)[ \t]*[^\n]*$")
7979
if(DEFINED GD_VERSION)
8080
string(APPEND GD_VERSION ".${CMAKE_MATCH_1}")
8181
else()

cmake/cmake/modules/FindNetSnmp.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ endif()
120120
# Get version.
121121
block(PROPAGATE NetSnmp_VERSION)
122122
if(NetSnmp_INCLUDE_DIR)
123-
set(regex "^[ \t]*#[ \t]*define[ \t]+PACKAGE_VERSION[ \t]+\"([^\"]+)\"[^\r\n]*$")
123+
set(regex "^[ \t]*#[ \t]*define[ \t]+PACKAGE_VERSION[ \t]+\"([^\"]+)\"[^\n]*$")
124124

125125
file(
126126
STRINGS

cmake/cmake/modules/FindPCRE.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,14 @@ block(PROPAGATE PCRE_VERSION)
6666
STRINGS
6767
${PCRE_INCLUDE_DIR}/pcre2.h
6868
results
69-
REGEX "^#[ \t]*define[ \t]+PCRE2_(MAJOR|MINOR)[ \t]+[0-9]+[^\r\n]*$"
69+
REGEX "^#[ \t]*define[ \t]+PCRE2_(MAJOR|MINOR)[ \t]+[0-9]+[^\n]*$"
7070
)
7171

7272
unset(PCRE_VERSION)
7373

7474
foreach(item MAJOR MINOR)
7575
foreach(line ${results})
76-
if(line MATCHES "^#[ \t]*define[ \t]+PCRE2_${item}[ \t]+([0-9]+)[^\r\n]*$")
76+
if(line MATCHES "^#[ \t]*define[ \t]+PCRE2_${item}[ \t]+([0-9]+)[^\n]*$")
7777
if(DEFINED PCRE_VERSION)
7878
string(APPEND PCRE_VERSION ".${CMAKE_MATCH_1}")
7979
else()

cmake/cmake/modules/Findlibavif.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,14 @@ block(PROPAGATE libavif_VERSION)
6969
${libavif_INCLUDE_DIR}/avif/avif.h
7070
results
7171
REGEX
72-
"^#[ \t]*define[ \t]+AVIF_VERSION_(MAJOR|MINOR|PATCH)[ \t]+[0-9]+[^\r\n]*$"
72+
"^#[ \t]*define[ \t]+AVIF_VERSION_(MAJOR|MINOR|PATCH)[ \t]+[0-9]+[^\n]*$"
7373
)
7474

7575
unset(libavif_VERSION)
7676

7777
foreach(item MAJOR MINOR PATCH)
7878
foreach(line ${results})
79-
if(line MATCHES "^#[ \t]*define[ \t]+AVIF_VERSION_${item}[ \t]+([0-9]+)[^\r\n]*$")
79+
if(line MATCHES "^#[ \t]*define[ \t]+AVIF_VERSION_${item}[ \t]+([0-9]+)[^\n]*$")
8080
if(DEFINED libavif_VERSION)
8181
string(APPEND libavif_VERSION ".${CMAKE_MATCH_1}")
8282
else()

cmake/cmake/modules/PHP/Extensions.cmake

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,9 @@ function(_php_extensions_parse_dependencies extension result)
198198
# Command invocation:
199199
"add_dependencies[ \t]*\\("
200200
# Target name:
201-
"[ \t\r\n]*php_ext_${extension}[ \t\r\n]+"
201+
"[ \t\n]*php_ext_${extension}[ \t\n]+"
202202
# Dependencies:
203-
"[\"]?(php_ext_[a-zA-Z0-9_; \t\r\n]+)"
203+
"[\"]?(php_ext_[a-zA-Z0-9_; \t\n]+)"
204204
)
205205

206206
string(REGEX MATCHALL "${regex}" matches "${content}")
@@ -247,22 +247,22 @@ endfunction()
247247
function(_php_extensions_option_regex option result)
248248
string(CONCAT _
249249
# Start of the option command invocation:
250-
"[ \t\r\n]?option[ \t]*\\([ \t\r\n]*"
250+
"[ \t\n]?option[ \t]*\\([ \t\n]*"
251251
# Variable name:
252-
"[ \t\r\n]*${option}[ \t\r\n]+"
252+
"[ \t\n]*${option}[ \t\n]+"
253253
# Documentation string without escaped double quotes (\"):
254254
# TODO: should escaped quotes be also matched?
255-
#"[ \t\r\n]*\"([^\"]|\\\")*\"[ \t\r\n]*"
256-
"[ \t\r\n]*\"[^\"]*\"[ \t\r\n]*"
255+
#"[ \t\n]*\"([^\"]|\\\")*\"[ \t\n]*"
256+
"[ \t\n]*\"[^\"]*\"[ \t\n]*"
257257
# Optional boolean or variable value:
258-
"([ \t\r\n]+("
258+
"([ \t\n]+("
259259
"ON|on|TRUE|true|YES|yes|Y|y|"
260260
"OFF|off|FALSE|false|NO|no|N|n|"
261261
"[0-9.]+|"
262262
"\\\$\\{[^\\}]+\\}"
263263
"))?"
264264
# End of option invocation:
265-
"[ \t\r\n]*\\)"
265+
"[ \t\n]*\\)"
266266
)
267267

268268
set(${result} "${_}" PARENT_SCOPE)
@@ -272,31 +272,31 @@ endfunction()
272272
function(_php_extensions_cmake_dependent_option_regex option result)
273273
string(CONCAT _
274274
# Start of the option command invocation:
275-
"[ \t\r\n]?cmake_dependent_option[ \t]*\\([ \t\r\n]*"
275+
"[ \t\n]?cmake_dependent_option[ \t]*\\([ \t\n]*"
276276
# Variable name:
277-
"[ \t\r\n]*${option}[ \t\r\n]+"
277+
"[ \t\n]*${option}[ \t\n]+"
278278
# Documentation string without escaped double quotes (\"):
279279
# TODO: should escaped quotes be also matched?
280-
#"[ \t\r\n]*\"([^\"]|\\\")*\"[ \t\r\n]*"
281-
"[ \t\r\n]*\"[^\"]*\"[ \t\r\n]*"
280+
#"[ \t\n]*\"([^\"]|\\\")*\"[ \t\n]*"
281+
"[ \t\n]*\"[^\"]*\"[ \t\n]*"
282282
# Boolean or variable value:
283-
"[ \t\r\n]+("
283+
"[ \t\n]+("
284284
"ON|on|TRUE|true|YES|yes|Y|y|"
285285
"OFF|off|FALSE|false|NO|no|N|n|"
286286
"[0-9.]+|"
287287
"\\\$\\{[^\\}]+\\}"
288288
")"
289289
# Semicolon separated list of conditions:
290-
"[ \t\r\n]*\"[^\"]*\"[ \t\r\n]*"
290+
"[ \t\n]*\"[^\"]*\"[ \t\n]*"
291291
# Boolean or variable force value:
292-
"[ \t\r\n]+("
292+
"[ \t\n]+("
293293
"ON|on|TRUE|true|YES|yes|Y|y|"
294294
"OFF|off|FALSE|false|NO|no|N|n|"
295295
"[0-9.]+|"
296296
"\\\$\\{[^\\}]+\\}"
297297
")"
298298
# End of option invocation:
299-
"[ \t\r\n]*\\)"
299+
"[ \t\n]*\\)"
300300
)
301301

302302
set(${result} "${_}" PARENT_SCOPE)
@@ -361,7 +361,7 @@ endfunction()
361361

362362
# Remove line comments from CMake code content.
363363
function(_php_extensions_remove_comments)
364-
string(REGEX REPLACE "[ \t]*#[^\r\n]*" "" ${ARGV0} "${${ARGV0}}")
364+
string(REGEX REPLACE "[ \t]*#[^\n]*" "" ${ARGV0} "${${ARGV0}}")
365365
set(${ARGV0} "${${ARGV0}}" PARENT_SCOPE)
366366
endfunction()
367367

cmake/cmake/modules/PHP/Set.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ function(php_set)
242242
if(DEFINED parsed_IF)
243243
# Make condition look nice in the possible output strings.
244244
string(STRIP "${parsed_IF}" parsed_IF)
245-
string(REGEX REPLACE "[ \t]*[\r\n]+[ \t\r\n]*" "\n" parsed_IF "${parsed_IF}")
245+
string(REGEX REPLACE "[ \t]*[\n]+[ \t\n]*" "\n" parsed_IF "${parsed_IF}")
246246
foreach(d ${parsed_IF})
247247
cmake_language(EVAL CODE "
248248
if(${d})

0 commit comments

Comments
 (0)