Update regular expression to handle more variants

Older CentOS versions returns the version string on this format:

    gcc (aaa) x.y.z yyyymmdd (bbb)
This commit is contained in:
Roland Kaufmann 2013-03-07 12:29:23 +01:00
parent 3ae89d0754
commit c81bd58c3f

View File

@ -31,7 +31,7 @@ function (get_gcc_patch language ver_name)
# only keep first line
list (GET _version 0 _version)
# extract version number from it (this is the fragile part)
string (REGEX REPLACE "^.+(\\(.*\\))?.*([0-9]+\\.[0-9]+\\.[0-9]+)" "\\2" _version "${_version}")
string (REGEX REPLACE "^[^\\(]+(\\([^\\)]*\\))?[\ \t]*([0-9]+\\.[0-9]+\\.[0-9]+)(.*\\(.*\\))?" "\\2" _version "${_version}")
# return this to the caller
set (${ver_name} ${_version} PARENT_SCOPE)
else (CMAKE_${language}_COMPILER_ID STREQUAL GNU)