]> git.uio.no Git - u/mrichter/AliRoot.git/blame - cmake/FindFASTJET.cmake
Update z position of ADA (Z=1699.7)
[u/mrichter/AliRoot.git] / cmake / FindFASTJET.cmake
CommitLineData
36799128 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
f4809a5d 16# AliRoot Build System Module to find and configure FASTJET
36799128 17# Author: Marco van Leeuwen
18# FastJet installation is pointed during cmake configuration -DFASTJET
19# Variables set during Find:
20# - FASTJET_CONFIG - fastjet-config location
21# - FASTJET_VERSION
22# - FASTJET_VERSION_MAJOR
23# - FASTJET_VERSION_MINOR
24# - FASTJET_VERSION_PATCH
25# - FASTJET_INCLUDE_DIR - fastjet headers location
5e8fe0e0 26# - FASTJET_LIBS_DIR - fastjet libraries location
36799128 27# - FASTJET_DEFINITIONS - fastjet definition flags
28# - FASTJET_CXXFLAGS - fastjet compilation flags
5e8fe0e0 29# - FASTJET_LIBS - fastjet libraries - array
36799128 30
31set(FASTJET_FOUND FALSE)
32
33if(FASTJET)
34 # Check for fastjet-config script
35 find_program(FASTJET_CONFIG NAMES fastjet-config PATHS ${FASTJET}/bin NO_DEFAULT_PATH)
36 if(NOT FASTJET_CONFIG)
37 message(FATAL_ERROR "Could not find fastjet-config executable")
38 endif(NOT FASTJET_CONFIG)
9f4ff23c 39 mark_as_advanced(FASTJET_CONFIG)
36799128 40
41 # Check for header installation
42 find_path(FASTJETHH include/fastjet/PseudoJet.hh PATHS ${FASTJET})
43
44 if (FASTJETHH-NOTFOUND)
45 message(FATAL_ERROR "Header file fastjet/PseudoJet.hh not found in ${FASTJET}/include. Please check your FASTJET installation")
46 endif(FASTJETHH-NOTFOUND)
9f4ff23c 47 mark_as_advanced(FASTJETHH)
f4809a5d 48
36799128 49 # FastJet version
50 execute_process(COMMAND ${FASTJET_CONFIG} --version OUTPUT_VARIABLE FASTJET_VERSION ERROR_VARIABLE error OUTPUT_STRIP_TRAILING_WHITESPACE )
51 if(error)
52 message(FATAL_ERROR "Error retrieving FastJet version : ${error}")
53 endif(error)
54
55 # Extract major, minor, and patch versions from
56 string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" FASTJET_VERSION_MAJOR "${FASTJET_VERSION}")
57 string(REGEX REPLACE "^[0-9]+\\.([0-9])+\\.[0-9]+.*" "\\1" FASTJET_VERSION_MINOR "${FASTJET_VERSION}")
58 string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" FASTJET_VERSION_PATCH "${FASTJET_VERSION}")
6112f260 59
60 if(FASTJET_VERSION_MAJOR LESS 3)
168930f9 61 message(FATAL_ERROR "FastJet ${FASTJET_VERSION_MAJOR}.${FASTJET_VERSION_MINOR}.${FASTJET_VERSION_PATCH} version is not suported. Please install a version >= 3.0.*")
62 endif()
63
4a52b01a 64 if(FASTJET_VERSION_MINOR GREATER 0)
168930f9 65 message(FATAL_ERROR "FastJet ${FASTJET_VERSION_MAJOR}.${FASTJET_VERSION_MINOR}.${FASTJET_VERSION_PATCH} version is not suported. Please install a version >= 3.0.*")
6112f260 66 endif()
36799128 67
68 # Extracting compilation flags
69 execute_process(COMMAND ${FASTJET_CONFIG} --cxxflags OUTPUT_VARIABLE FASTJET_CXXFLAGS ERROR_VARIABLE error OUTPUT_STRIP_TRAILING_WHITESPACE )
70 if(error)
71 message(FATAL_ERROR "Error retrieving FastJet compilation flags : ${error}")
72 endif(error)
e8557193 73
74 # Extracting the include path from the CXX flags
75 set(FASTJET_INCLUDE_DIR)
76 if(FASTJET_CXXFLAGS)
77 string(STRIP ${FASTJET_CXXFLAGS} FASTJET_CXXFLAGS)
78 string(REGEX MATCHALL "[-][I]([^ ])+" incfolders ${FASTJET_CXXFLAGS})
79
80 foreach(incfolder ${incfolders})
81 string(REPLACE "-I" "" incfolder ${incfolder})
82 set(FASTJET_INCLUDE_DIR ${incfolder} ${FASTJET_INCLUDE_DIR})
83 endforeach()
84 endif(FASTJET_CXXFLAGS)
36799128 85
86 # Extracting libraries and linking options
5e8fe0e0 87 execute_process(COMMAND ${FASTJET_CONFIG} --libs OUTPUT_VARIABLE FASTJET_CONFIGLIBS ERROR_VARIABLE error OUTPUT_STRIP_TRAILING_WHITESPACE )
36799128 88 if(error)
89 message(FATAL_ERROR "Error retrieving FastJet libs : ${error}")
90 endif(error)
e8557193 91
92 # Extracting the list of needed libraries during linking and the linking folders
93 set(FASTJET_LIBS)
94 set(FASTJET_LIBS_DIR)
95 if(FASTJET_CONFIGLIBS)
96 string(STRIP ${FASTJET_CONFIGLIBS} FASTJET_CONFIGLIBS)
97
98 # Extracting the list of libraries needed during linking
99 # -l strings
100 string(REGEX MATCHALL "[-][l]([^ ])+" fjlibs "${FASTJET_CONFIGLIBS}")
101
102 foreach(flib ${fjlibs})
103 string(REPLACE "-l" "" flib "${flib}")
104 set(FASTJET_LIBS ${FASTJET_LIBS} ${flib})
105 endforeach()
5e8fe0e0 106
e8557193 107 # Extracting the list of libraries folders
108 # -L strings
109 string(REGEX MATCHALL "[-][L]([^ ])+" fjlibdirs "${FASTJET_CONFIGLIBS}")
110
111 foreach(fjlibdir ${fjlibdirs})
112 string(REPLACE "-L" "" fjlibdir ${fjlibdir})
113 set(FASTJET_LIBS_DIR ${fjlibdir} ${FASTJET_LIBS_DIR})
114 endforeach()
115 endif()
36799128 116
117 set(FASTJET_FOUND TRUE)
36799128 118 set(FASTJET_DEFINITIONS "-DHAVE_FASTJET")
119 message(STATUS "FastJet ${FASTJET_VERSION_MAJOR}.${FASTJET_VERSION_MINOR}.${FASTJET_VERSION_PATCH} installation found: ${FASTJET}")
120else()
121 message(STATUS "FastJet not found: disabling dependencies")
122endif(FASTJET)