]> git.uio.no Git - u/mrichter/AliRoot.git/blame - cmake/CheckCompiler.cmake
PAR: includes from previously enabled PARfiles
[u/mrichter/AliRoot.git] / cmake / CheckCompiler.cmake
CommitLineData
b22a7396 1
2# **************************************************************************
3# * Copyright(c) 1998-2014, ALICE Experiment at CERN, All rights reserved. *
4# * *
5# * Author: The ALICE Off-line Project. *
6# * Contributors are mentioned in the code where appropriate. *
7# * *
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# **************************************************************************
16
17# Compiler major and minor version
18# - CLANG_MAJOR.CLANG_MINOR or
19# - GCC_MAJOR.GCC_MINOR.GCC_PATCH
20
21message(STATUS "Found ${CMAKE_CXX_COMPILER_ID} compiler, version ${CMAKE_CXX_COMPILER_VERSION}")
22
23# Clang compiler
24if("${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}")
28endif()
29
30# GNU compiler
31if(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}")
36endif()