]> git.uio.no Git - u/mrichter/AliRoot.git/blob - cmake/FindAMORE.cmake
PAR: fixed wrong echo on OS X
[u/mrichter/AliRoot.git] / cmake / FindAMORE.cmake
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 # AMORE - used to generate the DAs
17 # Flags are filled using amore-config
18 #               - AMORE_VERSION
19 #               - AMORE_STATICLIBS - libraries and linking folders for static build
20 #               - AMORE_AUXLIBS - auxiliary libraries for DA 
21 #               - AMORE_DEFINITIONS
22 #               - AMORE_CFLAGS
23 #               - AMORE_INCLUDE_DIR
24
25 set(AMORE_FOUND FALSE)
26
27 if(AMORE_CONFIG)
28     # Setting ROOTSYS environment variable for the amore-config to find root-config
29     # The variable is unset after the Find is finished
30     set(ENV{ROOTSYS} ${ROOTSYS})
31
32     # Checking AMORE version
33     execute_process(COMMAND ${AMORE_CONFIG} --version OUTPUT_VARIABLE AMORE_VERSION ERROR_VARIABLE error OUTPUT_STRIP_TRAILING_WHITESPACE )
34     if(error)
35         message(FATAL_ERROR "Error retrieving AMORE version : ${error}")
36     endif(error)
37     
38     if(AMORE_VERSION)
39         string(STRIP ${AMORE_VERSION} AMORE_VERSION)
40     endif(AMORE_VERSION)
41
42     # Extract major, minor, and patch versions from
43 #    string(REGEX REPLACE "^([0-9]+)\\.[0-9]+" "\\1" DATE_VERSION_MAJOR "${DATE_VERSION}")
44 #    string(REGEX REPLACE "^[0-9]+\\.([0-9]+)" "\\1" DATE_VERSION_MINOR "${DATE_VERSION}")
45     message(STATUS "AMORE version ${AMORE_VERSION} found.")
46
47     # Checking AMORE static libraries
48     execute_process(COMMAND ${AMORE_CONFIG} --ldflags-da-static OUTPUT_VARIABLE AMORE_STATICLIBS ERROR_VARIABLE error OUTPUT_STRIP_TRAILING_WHITESPACE )
49     if(error)
50         message(FATAL_ERROR "Error retrieving AMORE static libraries : ${error}")
51     endif(error)
52     
53     if(AMORE_STATICLIBS)
54         string(STRIP ${AMORE_STATICLIBS} AMORE_STATICLIBS)
55         string(REPLACE "\n" " " AMORE_STATICLIBS ${AMORE_STATICLIBS})
56     endif(AMORE_STATICLIBS)
57
58     # Checking AMORE auxiliary libraries
59     execute_process(COMMAND ${AMORE_CONFIG} --auxlibs-list OUTPUT_VARIABLE AMORE_AUXLIBS ERROR_VARIABLE error OUTPUT_STRIP_TRAILING_WHITESPACE )
60     if(error)
61         message(FATAL_ERROR "Error retrieving AMORE auxiliary libraries : ${error}")
62     endif(error)
63     
64     if(AMORE_AUXLIBS)
65         string(STRIP ${AMORE_AUXLIBS} AMORE_AUXLIBS)
66     endif(AMORE_AUXLIBS)
67
68     # Checking AMORE cflags
69     execute_process(COMMAND ${AMORE_CONFIG} --cflags OUTPUT_VARIABLE AMORE_CFLAGS ERROR_VARIABLE error OUTPUT_STRIP_TRAILING_WHITESPACE )
70     if(error)
71         message(FATAL_ERROR "Error retrieving AMORE cflags : ${error}")
72     endif(error)
73     
74     if(AMORE_CFLAGS)
75         string(STRIP ${AMORE_CFLAGS} AMORE_CFLAGS)
76     endif(AMORE_CFLAGS)
77
78     # Checking AMORE cflags
79     execute_process(COMMAND ${AMORE_CONFIG} --include-dir OUTPUT_VARIABLE AMORE_INCLUDE_DIR ERROR_VARIABLE error OUTPUT_STRIP_TRAILING_WHITESPACE )
80     if(error)
81         message(FATAL_ERROR "Error retrieving AMORE include directory : ${error}")
82     endif(error)
83     
84     if(AMORE_INCLUDE_DIR)
85         string(STRIP ${AMORE_INCLUDE_DIR} AMORE_INCLUDE_DIR)
86     endif(AMORE_INCLUDE_DIR)
87
88     set(AMORE_DEFINITIONS "-DALI_AMORE")
89     set(AMORE_FOUND TRUE)
90     unset(ENV{ROOTSYS})
91
92 endif(AMORE_CONFIG)