1 # **************************************************************************
2 # * Copyright(c) 1998-2014, ALICE Experiment at CERN, All rights reserved. *
4 # * Author: The ALICE Off-line Project. *
5 # * Contributors are mentioned in the code where appropriate. *
7 # * Permission to use, copy, modify and distribute this software and its *
8 # * documentation strictly for non-commercial purposes is hereby granted *
9 # * without fee, provided that the above copyright notice appears in all *
10 # * copies and that both the copyright notice and this permission notice *
11 # * appear in the supporting documentation. The authors make no claims *
12 # * about the suitability of this software for any purpose. It is *
13 # * provided "as is" without express or implied warranty. *
14 # **************************************************************************
16 # Checking for a proper ROOT installation based on the ROOTSYS variable
17 # received during configuration
18 # If proper root installation it is setting the following variables
19 # - ROOT_VERSION - ROOT version as reported by root-config
20 # - ROOT_VERSION_MAJOR
21 # - ROOT_VERSIOM_MINOR
22 # - ROOT_VERSION_PATCH
23 # - ROOT_CONFIG - path to root-config script
24 # - ROOT_CINT - path to rootcint executable
25 # - ROOT_FEATURES - list of build features for ROOT
26 # - ROOT_LIBDIR - full path to ROOT library folder
27 # - ROOT_LIBRARIES - libraries needed for the package to be used
28 # - ROOT_INCLUDE_DIRS - full path to ROOT include folder
29 # - ROOT_GLIBS - regular + GUI ROOT libraries + path to be used during linking
30 # - ROOT_HASALIEN - ROOT was built with AliEn support
31 # - ROOT_HASXML - ROOT was built with XML support
35 message(STATUS "Checking for a proper ROOT installation in ${ROOTSYS}.")
37 # Setting the LD_LiBRARY_PATH to point to ROOT lib folder
38 set(ROOT_LIBDIR ${ROOTSYS}/lib)
39 set(ROOT_INCLUDE_DIRS ${ROOTSYS}/include)
41 # Check for root-config scripts
42 find_program(ROOT_CONFIG NAMES root-config PATHS ${ROOTSYS}/bin NO_DEFAULT_PATH)
45 message(STATUS "Found root-config: ${ROOT_CONFIG}")
47 message(FATAL_ERROR "Could not find root-config script.")
51 find_program(ROOT_CINT NAMES rootcint PATHS ${ROOTSYS}/bin NO_DEFAULT_PATH)
53 message(STATUS "Found ${ROOT_CINT}")
55 message(FATAL_ERROR "Could not find rootcint executable.")
58 # Checking ROOT version
59 execute_process(COMMAND ${ROOT_CONFIG} --version OUTPUT_VARIABLE ROOT_VERSION ERROR_VARIABLE error OUTPUT_STRIP_TRAILING_WHITESPACE )
61 message(FATAL_ERROR "Error retrieving ROOT version : ${error}")
64 # Extract major, minor, and patch versions from
65 string(REGEX REPLACE "^([0-9]+)\\.[0-9][0-9]+\\/[0-9][0-9]+.*" "\\1" ROOT_VERSION_MAJOR "${ROOT_VERSION}")
66 string(REGEX REPLACE "^[0-9]+\\.([0-9][0-9])+\\/[0-9][0-9]+.*" "\\1" ROOT_VERSION_MINOR "${ROOT_VERSION}")
67 string(REGEX REPLACE "^[0-9]+\\.[0-9][0-9]+\\/([0-9][0-9]+).*" "\\1" ROOT_VERSION_PATCH "${ROOT_VERSION}")
68 message(STATUS "Found ROOT version ${ROOT_VERSION_MAJOR}.${ROOT_VERSION_MINOR}.${ROOT_VERSION_PATCH}")
71 execute_process(COMMAND ${ROOT_CONFIG} --features OUTPUT_VARIABLE ROOT_FEATURES ERROR_VARIABLE error OUTPUT_STRIP_TRAILING_WHITESPACE )
73 message(FATAL_ERROR "Error retrieving ROOT features : ${error}")
75 message(STATUS "ROOT was build with the following features: ${ROOT_FEATURES}")
78 # Checking for ROOT libdir
79 execute_process(COMMAND ${ROOT_CONFIG} --libdir OUTPUT_VARIABLE ROOT_LIBDIR ERROR_VARIABLE error OUTPUT_STRIP_TRAILING_WHITESPACE )
81 message(FATAL_ERROR "Error retrieving ROOT libdir: ${error}")
84 # Checking for ROOT incdir
85 execute_process(COMMAND ${ROOT_CONFIG} --incdir OUTPUT_VARIABLE ROOT_INCDIR ERROR_VARIABLE error OUTPUT_STRIP_TRAILING_WHITESPACE )
87 message(FATAL_ERROR "Error retrieving ROOT incdir: ${error}")
91 execute_process(COMMAND ${ROOT_CONFIG} --glibs OUTPUT_VARIABLE ROOT_GLIBS ERROR_VARIABLE error OUTPUT_STRIP_TRAILING_WHITESPACE )
93 message(FATAL_ERROR "Error retrieving ROOT glibs: ${error}")
97 execute_process(COMMAND ${ROOT_CONFIG} --has-alien OUTPUT_VARIABLE ROOT_HASALIEN ERROR_VARIABLE error OUTPUT_STRIP_TRAILING_WHITESPACE )
99 message(FATAL_ERROR "Error checking if ROOT was build with AliEn support: ${error}")
102 execute_process(COMMAND ${ROOT_CONFIG} --has-xml OUTPUT_VARIABLE ROOT_HASXML ERROR_VARIABLE error OUTPUT_STRIP_TRAILING_WHITESPACE )
104 message(FATAL_ERROR "Error checking if ROOT was build with xml support: ${error}")
109 message(FATAL_ERROR "ROOT installation not found! Please point to the ROOT installation using -DROOTSYS=ROOT_INSTALL_DIR.")