]>
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 | |
0224bae4 | 25 | # - ROOT_LIBMAP - path to rlibmap executable |
fffaf6a5 | 26 | # - ROOT_FEATURES - list of build features for ROOT |
27 | # - ROOT_LIBDIR - full path to ROOT library folder | |
28 | # - ROOT_LIBRARIES - libraries needed for the package to be used | |
a0f34e87 | 29 | # - ROOT_GLIBRARIES - regular + GUI ROOT libraries + path to be used during linking |
fffaf6a5 | 30 | # - ROOT_INCLUDE_DIRS - full path to ROOT include folder |
fffaf6a5 | 31 | # - ROOT_HASALIEN - ROOT was built with AliEn support |
32 | # - ROOT_HASXML - ROOT was built with XML support | |
1dbe1076 | 33 | # - ROOT_FORTRAN - fortran compiler |
fffaf6a5 | 34 | |
35 | if(ROOTSYS) | |
36 | message(STATUS "Checking for a proper ROOT installation in ${ROOTSYS}.") | |
37 | ||
38 | # Setting the LD_LiBRARY_PATH to point to ROOT lib folder | |
39 | set(ROOT_LIBDIR ${ROOTSYS}/lib) | |
40 | set(ROOT_INCLUDE_DIRS ${ROOTSYS}/include) | |
41 | ||
42 | # Check for root-config scripts | |
43 | find_program(ROOT_CONFIG NAMES root-config PATHS ${ROOTSYS}/bin NO_DEFAULT_PATH) | |
44 | ||
45 | if(ROOT_CONFIG) | |
46 | message(STATUS "Found root-config: ${ROOT_CONFIG}") | |
47 | else() | |
48 | message(FATAL_ERROR "Could not find root-config script.") | |
49 | endif(ROOT_CONFIG) | |
50 | ||
0224bae4 | 51 | # Check for rlibmap |
52 | find_program(ROOT_LIBMAP NAMES rlibmap PATHS ${ROOTSYS}/bin NO_DEFAULT_PATH) | |
53 | if(ROOT_LIBMAP) | |
54 | message(STATUS "Found ${ROOT_LIBMAP}") | |
55 | else() | |
56 | message(FATAL_ERROR "Could not find rlibmap executable.") | |
57 | endif(ROOT_LIBMAP) | |
58 | ||
fffaf6a5 | 59 | # Check for rootcint |
60 | find_program(ROOT_CINT NAMES rootcint PATHS ${ROOTSYS}/bin NO_DEFAULT_PATH) | |
61 | if(ROOT_CINT) | |
62 | message(STATUS "Found ${ROOT_CINT}") | |
63 | else() | |
64 | message(FATAL_ERROR "Could not find rootcint executable.") | |
65 | endif(ROOT_CINT) | |
66 | ||
67 | # Checking ROOT version | |
68 | execute_process(COMMAND ${ROOT_CONFIG} --version OUTPUT_VARIABLE ROOT_VERSION ERROR_VARIABLE error OUTPUT_STRIP_TRAILING_WHITESPACE ) | |
69 | if(error) | |
70 | message(FATAL_ERROR "Error retrieving ROOT version : ${error}") | |
71 | endif(error) | |
a0f34e87 | 72 | string(STRIP ${ROOT_VERSION} ROOT_VERSION) |
73 | ||
fffaf6a5 | 74 | # Extract major, minor, and patch versions from |
75 | string(REGEX REPLACE "^([0-9]+)\\.[0-9][0-9]+\\/[0-9][0-9]+.*" "\\1" ROOT_VERSION_MAJOR "${ROOT_VERSION}") | |
76 | string(REGEX REPLACE "^[0-9]+\\.([0-9][0-9])+\\/[0-9][0-9]+.*" "\\1" ROOT_VERSION_MINOR "${ROOT_VERSION}") | |
77 | string(REGEX REPLACE "^[0-9]+\\.[0-9][0-9]+\\/([0-9][0-9]+).*" "\\1" ROOT_VERSION_PATCH "${ROOT_VERSION}") | |
78 | message(STATUS "Found ROOT version ${ROOT_VERSION_MAJOR}.${ROOT_VERSION_MINOR}.${ROOT_VERSION_PATCH}") | |
79 | ||
80 | # Print ROOT features | |
81 | execute_process(COMMAND ${ROOT_CONFIG} --features OUTPUT_VARIABLE ROOT_FEATURES ERROR_VARIABLE error OUTPUT_STRIP_TRAILING_WHITESPACE ) | |
82 | if(error) | |
83 | message(FATAL_ERROR "Error retrieving ROOT features : ${error}") | |
84 | else() | |
85 | message(STATUS "ROOT was build with the following features: ${ROOT_FEATURES}") | |
86 | endif(error) | |
a0f34e87 | 87 | string(STRIP ${ROOT_FEATURES} ROOT_FEATURES) |
88 | ||
fffaf6a5 | 89 | # Checking for ROOT libdir |
90 | execute_process(COMMAND ${ROOT_CONFIG} --libdir OUTPUT_VARIABLE ROOT_LIBDIR ERROR_VARIABLE error OUTPUT_STRIP_TRAILING_WHITESPACE ) | |
91 | if(error) | |
92 | message(FATAL_ERROR "Error retrieving ROOT libdir: ${error}") | |
93 | endif(error) | |
a0f34e87 | 94 | string(STRIP ${ROOT_LIBDIR} ROOT_LIBDIR) |
fffaf6a5 | 95 | |
0224bae4 | 96 | # Checking for ROOT libs |
a0f34e87 | 97 | execute_process(COMMAND ${ROOT_CONFIG} --noldflags --libs OUTPUT_VARIABLE ROOT_LIBS ERROR_VARIABLE error OUTPUT_STRIP_TRAILING_WHITESPACE ) |
0224bae4 | 98 | if(error) |
99 | message(FATAL_ERROR "Error retrieving ROOT libdir: ${error}") | |
100 | endif(error) | |
a0f34e87 | 101 | string(STRIP ${ROOT_LIBS} ROOT_LIBS) |
102 | ||
103 | foreach(lib ${ROOT_LIBS}) | |
104 | string(REPLACE "-rdynamic" "" new_lib ${lib}) | |
105 | string(REPLACE "-l" "" lib ${new_lib}) | |
106 | set(ROOT_LIBRARIES ${ROOT_LIBRARIES} ${lib}) | |
107 | endforeach() | |
108 | string(STRIP ${ROOT_LIBRARIES} ROOT_LIBRARIES) | |
109 | separate_arguments(ROOT_LIBRARIES) | |
110 | ||
fffaf6a5 | 111 | # Checking for ROOT incdir |
112 | execute_process(COMMAND ${ROOT_CONFIG} --incdir OUTPUT_VARIABLE ROOT_INCDIR ERROR_VARIABLE error OUTPUT_STRIP_TRAILING_WHITESPACE ) | |
113 | if(error) | |
114 | message(FATAL_ERROR "Error retrieving ROOT incdir: ${error}") | |
115 | endif(error) | |
a0f34e87 | 116 | string(STRIP ${ROOT_INCDIR} ROOT_INCDIR) |
117 | ||
fffaf6a5 | 118 | # Checking for glibs |
a0f34e87 | 119 | execute_process(COMMAND ${ROOT_CONFIG} --noldflags --glibs OUTPUT_VARIABLE ROOT_GLIBS ERROR_VARIABLE error OUTPUT_STRIP_TRAILING_WHITESPACE ) |
fffaf6a5 | 120 | if(error) |
121 | message(FATAL_ERROR "Error retrieving ROOT glibs: ${error}") | |
122 | endif(error) | |
123 | ||
124 | # Checking for glibs | |
a0f34e87 | 125 | string(STRIP ${ROOT_GLIBS} ROOT_GLIBS) |
126 | ||
127 | foreach(lib ${ROOT_GLIBS}) | |
128 | string(REPLACE "-rdynamic" "" new_lib "${lib}") | |
129 | string(REPLACE "-l" "" lib "${new_lib}") | |
130 | set(ROOT_GLIBRARIES ${ROOT_GLIBRARIES} ${lib}) | |
131 | endforeach() | |
132 | string(STRIP ${ROOT_GLIBRARIES} ROOT_GLIBRARIES) | |
133 | separate_arguments(ROOT_GLIBRARIES) | |
134 | ||
135 | # Checking for AliEn support | |
fffaf6a5 | 136 | execute_process(COMMAND ${ROOT_CONFIG} --has-alien OUTPUT_VARIABLE ROOT_HASALIEN ERROR_VARIABLE error OUTPUT_STRIP_TRAILING_WHITESPACE ) |
137 | if(error) | |
138 | message(FATAL_ERROR "Error checking if ROOT was build with AliEn support: ${error}") | |
139 | endif(error) | |
a0f34e87 | 140 | string(STRIP ${ROOT_HASALIEN} ROOT_HASALIEN) |
141 | ||
142 | # Checking for xml support | |
fffaf6a5 | 143 | execute_process(COMMAND ${ROOT_CONFIG} --has-xml OUTPUT_VARIABLE ROOT_HASXML ERROR_VARIABLE error OUTPUT_STRIP_TRAILING_WHITESPACE ) |
144 | if(error) | |
145 | message(FATAL_ERROR "Error checking if ROOT was build with xml support: ${error}") | |
146 | endif(error) | |
a0f34e87 | 147 | string(STRIP ${ROOT_HASXML} ROOT_HASXML) |
1dbe1076 | 148 | |
149 | ||
150 | # Checking for xml support | |
151 | execute_process(COMMAND ${ROOT_CONFIG} --f77 OUTPUT_VARIABLE ROOT_FORTRAN ERROR_VARIABLE error OUTPUT_STRIP_TRAILING_WHITESPACE ) | |
152 | if(error) | |
153 | message(FATAL_ERROR "Error checking ROOT fortran compiler: ${error}") | |
154 | endif(error) | |
155 | string(STRIP ${ROOT_FORTRAN} ROOT_FORTRAN) | |
a0f34e87 | 156 | |
fffaf6a5 | 157 | set(ROOT_FOUND TRUE) |
6db31708 | 158 | else() |
fffaf6a5 | 159 | message(FATAL_ERROR "ROOT installation not found! Please point to the ROOT installation using -DROOTSYS=ROOT_INSTALL_DIR.") |
160 | endif(ROOTSYS) |