2 # **************************************************************************
3 # * Copyright(c) 1998-2014, ALICE Experiment at CERN, All rights reserved. *
5 # * Author: The ALICE Off-line Project. *
6 # * Contributors are mentioned in the code where appropriate. *
8 # * Permission to use, copy, modify and distribute this software and its *
9 # * documentation strictly for non-commercial purposes is hereby granted *
10 # * without fee, provided that the above copyright notice appears in all *
11 # * copies and that both the copyright notice and this permission notice *
12 # * appear in the supporting documentation. The authors make no claims *
13 # * about the suitability of this software for any purpose. It is *
14 # * provided "as is" without express or implied warranty. *
15 # **************************************************************************
17 # Compiler major and minor version
18 # - CLANG_MAJOR.CLANG_MINOR or
19 # - GCC_MAJOR.GCC_MINOR.GCC_PATCH
21 message(STATUS "Found ${CMAKE_CXX_COMPILER_ID} compiler, version ${CMAKE_CXX_COMPILER_VERSION}")
24 if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
25 string(REGEX REPLACE "^.*[ ]([0-9]+)\\.[0-9].*$" "\\1" CLANG_MAJOR "${CMAKE_CXX_COMPILER_VERSION}")
26 string(REGEX REPLACE "^.*[ ][0-9]+\\.([0-9]).*$" "\\1" CLANG_MINOR "${CMAKE_CXX_COMPILER_VERSION}")
27 message(STATUS "Compiler MAJOR ${CLANG_MAJOR}, MINOR ${CLANG_MINOR}")
31 if(CMAKE_COMPILER_IS_GNUCXX)
32 string(REGEX REPLACE "^([0-9]+).*$" "\\1" GCC_MAJOR "${CMAKE_CXX_COMPILER_VERSION}")
33 string(REGEX REPLACE "^[0-9]+\\.([0-9]+).*$" "\\1" GCC_MINOR "${CMAKE_CXX_COMPILER_VERSION}")
34 string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1" GCC_PATCH "${CMAKE_CXX_COMPILER_VERSION}")
35 message(STATUS "Compiler major ${GCC_MAJOR}, minor ${GCC_MINOR}, patch ${GCC_PATCH}")