--- a/src/shared/cmake/MacroCheckGccVisibility.cmake
+++ b/src/shared/cmake/MacroCheckGccVisibility.cmake
@@ -15,7 +15,7 @@ macro(MACRO_CHECK_GCC_VISIBILITY GccVisibility)
    # get the gcc version
    exec_program(${CMAKE_C_COMPILER} ARGS --version OUTPUT_VARIABLE _gcc_version_info)
 
-   string (REGEX MATCH "[345]\\.[0-9]\\.[0-9]" _gcc_version "${_gcc_version_info}")
+   string (REGEX MATCH "[0-9]+\\.[0-9]\\.[0-9]" _gcc_version "${_gcc_version_info}")
    if (NOT _gcc_version)
    
       # clang reports: clang version 1.1 (trunk 95754)
@@ -26,7 +26,7 @@ macro(MACRO_CHECK_GCC_VISIBILITY GccVisibility)
    
       # gcc on mac just reports: "gcc (GCC) 3.3 20030304 ..." without the patch level, handle this here:
       if (NOT _gcc_version)
-        string (REGEX REPLACE ".*\\(GCC\\).* ([34]\\.[0-9]) .*" "\\1.0" _gcc_version "${_gcc_version_info}")
+        string (REGEX REPLACE ".*\\(Rev[0-9], Built by MSYS2 project\\).* ([0-9]+\\.[0-9]\\.[0-9]) .*" "\\1.0" _gcc_version "${_gcc_version_info}")
       endif (NOT _gcc_version)
    endif (NOT _gcc_version)
    
