File tree Expand file tree Collapse file tree 2 files changed +34
-32
lines changed Expand file tree Collapse file tree 2 files changed +34
-32
lines changed Original file line number Diff line number Diff line change @@ -432,38 +432,8 @@ if(XCODE)
432
432
swift_common_xcode_cxx_config ()
433
433
endif ()
434
434
435
- function (check_working_std_regex result_var_name )
436
- if ("${CMAKE_SYSTEM_NAME} " STREQUAL "Darwin" )
437
- # Apple operating systems use libc++, which has a working std::regex.
438
- set ("${result_var_name} " TRUE PARENT_SCOPE )
439
- else ()
440
- if (CMAKE_CROSSCOMPILING )
441
- # Can't run C source when cross-compiling; assume false until we have a static check.
442
- set ("${result_var_name} " FALSE PARENT_SCOPE )
443
- else ()
444
- # libstdc++ 4.8 has an incomplete std::regex implementation, and crashes
445
- # on many regexes.
446
- # libstdc++ 4.9 works.
447
- set (std_regex_test_source
448
- "
449
- #include <regex>
450
- const std::regex broken_regex{
451
- \" ([a]+)\" ,
452
- std::regex::ECMAScript | std::regex::nosubs};
453
-
454
- int main() {}
455
- " )
456
-
457
- check_cxx_source_runs ("${std_regex_test_source} " "${result_var_name} _TEST" )
458
- if ("${${result_var_name} _TEST}" )
459
- set ("${result_var_name} " TRUE PARENT_SCOPE )
460
- else ()
461
- set ("${result_var_name} " FALSE PARENT_SCOPE )
462
- endif ()
463
- endif ()
464
- endif ()
465
- endfunction ()
466
- check_working_std_regex (SWIFT_HAVE_WORKING_STD_REGEX )
435
+ include (SwiftCheckCXXNativeRegex )
436
+ check_cxx_native_regex (SWIFT_HAVE_WORKING_STD_REGEX )
467
437
468
438
# If SWIFT_HOST_VARIANT_SDK not given, try to detect from the CMAKE_SYSTEM_NAME.
469
439
if (SWIFT_HOST_VARIANT_SDK )
Original file line number Diff line number Diff line change
1
+ function (check_cxx_native_regex result_var_name )
2
+ if ("${CMAKE_SYSTEM_NAME} " STREQUAL "Darwin" )
3
+ # Apple operating systems use libc++, which has a working std::regex.
4
+ set ("${result_var_name} " TRUE PARENT_SCOPE )
5
+ else ()
6
+ if (CMAKE_CROSSCOMPILING )
7
+ # Can't run C source when cross-compiling; assume false until we have a static check.
8
+ set ("${result_var_name} " FALSE PARENT_SCOPE )
9
+ else ()
10
+ # libstdc++ 4.8 has an incomplete std::regex implementation, and crashes
11
+ # on many regexes.
12
+ # libstdc++ 4.9 works.
13
+ set (std_regex_test_source
14
+ "
15
+ #include <regex>
16
+ const std::regex broken_regex{
17
+ \" ([a]+)\" ,
18
+ std::regex::ECMAScript | std::regex::nosubs};
19
+
20
+ int main() {}
21
+ " )
22
+
23
+ check_cxx_source_runs ("${std_regex_test_source} " "${result_var_name} _TEST" )
24
+ if ("${${result_var_name} _TEST}" )
25
+ set ("${result_var_name} " TRUE PARENT_SCOPE )
26
+ else ()
27
+ set ("${result_var_name} " FALSE PARENT_SCOPE )
28
+ endif ()
29
+ endif ()
30
+ endif ()
31
+ endfunction ()
32
+
You can’t perform that action at this time.
0 commit comments