]>
Commit | Line | Data |
---|---|---|
fffaf6a5 | 1 | # ************************************************************************** |
2 | # * Copyright(c) 1998-2014, ALICE Experiment at CERN, All rights reserved. * | |
3 | # * * | |
4 | # * Author: The ALICE Off-line Project. * | |
5 | # * Contributors are mentioned in the code where appropriate. * | |
6 | # * * | |
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 | # ************************************************************************** | |
15 | ||
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 | |
32 | ||
33 | ||
34 | if(ROOTSYS) | |
35 | message(STATUS "Checking for a proper ROOT installation in ${ROOTSYS}.") | |
36 | ||
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) | |
40 | ||
41 | # Check for root-config scripts | |
42 | find_program(ROOT_CONFIG NAMES root-config PATHS ${ROOTSYS}/bin NO_DEFAULT_PATH) | |
43 | ||
44 | if(ROOT_CONFIG) | |
45 | message(STATUS "Found root-config: ${ROOT_CONFIG}") | |
46 | else() | |
47 | message(FATAL_ERROR "Could not find root-config script.") | |
48 | endif(ROOT_CONFIG) | |
49 | ||
50 | # Check for rootcint | |
51 | find_program(ROOT_CINT NAMES rootcint PATHS ${ROOTSYS}/bin NO_DEFAULT_PATH) | |
52 | if(ROOT_CINT) | |
53 | message(STATUS "Found ${ROOT_CINT}") | |
54 | else() | |
55 | message(FATAL_ERROR "Could not find rootcint executable.") | |
56 | endif(ROOT_CINT) | |
57 | ||
58 | # Checking ROOT version | |
59 | execute_process(COMMAND ${ROOT_CONFIG} --version OUTPUT_VARIABLE ROOT_VERSION ERROR_VARIABLE error OUTPUT_STRIP_TRAILING_WHITESPACE ) | |
60 | if(error) | |
61 | message(FATAL_ERROR "Error retrieving ROOT version : ${error}") | |
62 | endif(error) | |
63 | ||
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}") | |
69 | ||
70 | # Print ROOT features | |
71 | execute_process(COMMAND ${ROOT_CONFIG} --features OUTPUT_VARIABLE ROOT_FEATURES ERROR_VARIABLE error OUTPUT_STRIP_TRAILING_WHITESPACE ) | |
72 | if(error) | |
73 | message(FATAL_ERROR "Error retrieving ROOT features : ${error}") | |
74 | else() | |
75 | message(STATUS "ROOT was build with the following features: ${ROOT_FEATURES}") | |
76 | endif(error) | |
77 | ||
78 | # Checking for ROOT libdir | |
79 | execute_process(COMMAND ${ROOT_CONFIG} --libdir OUTPUT_VARIABLE ROOT_LIBDIR ERROR_VARIABLE error OUTPUT_STRIP_TRAILING_WHITESPACE ) | |
80 | if(error) | |
81 | message(FATAL_ERROR "Error retrieving ROOT libdir: ${error}") | |
82 | endif(error) | |
83 | ||
84 | # Checking for ROOT incdir | |
85 | execute_process(COMMAND ${ROOT_CONFIG} --incdir OUTPUT_VARIABLE ROOT_INCDIR ERROR_VARIABLE error OUTPUT_STRIP_TRAILING_WHITESPACE ) | |
86 | if(error) | |
87 | message(FATAL_ERROR "Error retrieving ROOT incdir: ${error}") | |
88 | endif(error) | |
89 | ||
90 | # Checking for glibs | |
91 | execute_process(COMMAND ${ROOT_CONFIG} --glibs OUTPUT_VARIABLE ROOT_GLIBS ERROR_VARIABLE error OUTPUT_STRIP_TRAILING_WHITESPACE ) | |
92 | if(error) | |
93 | message(FATAL_ERROR "Error retrieving ROOT glibs: ${error}") | |
94 | endif(error) | |
95 | ||
96 | # Checking for glibs | |
97 | execute_process(COMMAND ${ROOT_CONFIG} --has-alien OUTPUT_VARIABLE ROOT_HASALIEN ERROR_VARIABLE error OUTPUT_STRIP_TRAILING_WHITESPACE ) | |
98 | if(error) | |
99 | message(FATAL_ERROR "Error checking if ROOT was build with AliEn support: ${error}") | |
100 | endif(error) | |
101 | ||
102 | execute_process(COMMAND ${ROOT_CONFIG} --has-xml OUTPUT_VARIABLE ROOT_HASXML ERROR_VARIABLE error OUTPUT_STRIP_TRAILING_WHITESPACE ) | |
103 | if(error) | |
104 | message(FATAL_ERROR "Error checking if ROOT was build with xml support: ${error}") | |
105 | endif(error) | |
106 | ||
107 | set(ROOT_FOUND TRUE) | |
6db31708 | 108 | else() |
fffaf6a5 | 109 | message(FATAL_ERROR "ROOT installation not found! Please point to the ROOT installation using -DROOTSYS=ROOT_INSTALL_DIR.") |
110 | endif(ROOTSYS) |