Skip to content
Snippets Groups Projects
Commit ac66c6a2 authored by Fons Rademakers's avatar Fons Rademakers
Browse files

From Brett Viren:

fix gcc version detection.


git-svn-id: http://root.cern.ch/svn/root/trunk@44252 27541ba8-7e3a-0410-8455-c3a389f83636
parent 8f3deec1
No related branches found
No related tags found
No related merge requests found
...@@ -25,9 +25,19 @@ endif() ...@@ -25,9 +25,19 @@ endif()
#---Obtain the major and minor version of the GNU compiler------------------------------------------- #---Obtain the major and minor version of the GNU compiler-------------------------------------------
if (CMAKE_COMPILER_IS_GNUCXX) if (CMAKE_COMPILER_IS_GNUCXX)
exec_program(${CMAKE_C_COMPILER} ARGS "-dumpversion" OUTPUT_VARIABLE _gcc_version_info) exec_program(${CMAKE_C_COMPILER} ARGS "-dumpversion" OUTPUT_VARIABLE _gcc_version_info)
string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.?([0-9])?" "\\1" GCC_MAJOR "${_gcc_version_info}") string(REGEX REPLACE "^([0-9]+).*$" "\\1" GCC_MAJOR ${_gcc_version_info})
string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.?([0-9])?" "\\2" GCC_MINOR "${_gcc_version_info}") string(REGEX REPLACE "^[0-9]+\\.([0-9]+).*$" "\\1" GCC_MINOR ${_gcc_version_info})
string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.?([0-9])?" "\\3" GCC_PATCH "${_gcc_version_info}") string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1" GCC_PATCH ${_gcc_version_info})
if(GCC_PATCH MATCHES "\\.+")
set(GCC_PATCH "")
endif()
if(GCC_MINOR MATCHES "\\.+")
set(GCC_MINOR "")
endif()
if(GCC_MAJOR MATCHES "\\.+")
set(GCC_MAJOR "")
endif()
message(STATUS "Found GCC. Major version ${GCC_MAJOR}, minor version ${GCC_MINOR}") message(STATUS "Found GCC. Major version ${GCC_MAJOR}, minor version ${GCC_MINOR}")
set(COMPILER_VERSION gcc${GCC_MAJOR}${GCC_MINOR}${GCC_PATCH}) set(COMPILER_VERSION gcc${GCC_MAJOR}${GCC_MINOR}${GCC_PATCH})
else() else()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment