]> git.uio.no Git - u/mrichter/AliRoot.git/blob - cmake/FindAMORE.cmake
FMD DAs
[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     # Checking AMORE version
29     execute_process(COMMAND ${AMORE_CONFIG} --version OUTPUT_VARIABLE AMORE_VERSION ERROR_VARIABLE error OUTPUT_STRIP_TRAILING_WHITESPACE )
30     if(error)
31         message(FATAL_ERROR "Error retrieving AMORE version : ${error}")
32     endif(error)
33     string(STRIP ${AMORE_VERSION} AMORE_VERSION)
34
35     # Extract major, minor, and patch versions from
36 #    string(REGEX REPLACE "^([0-9]+)\\.[0-9]+" "\\1" DATE_VERSION_MAJOR "${DATE_VERSION}")
37 #    string(REGEX REPLACE "^[0-9]+\\.([0-9]+)" "\\1" DATE_VERSION_MINOR "${DATE_VERSION}")
38     message(STATUS "AMORE version ${AMORE_VERSION} found.")
39
40     # Checking AMORE static libraries
41     execute_process(COMMAND ${AMORE_CONFIG} --ldflags-da-static OUTPUT_VARIABLE AMORE_STATICLIBS ERROR_VARIABLE error OUTPUT_STRIP_TRAILING_WHITESPACE )
42     if(error)
43         message(FATAL_ERROR "Error retrieving AMORE static libraries : ${error}")
44     endif(error)
45     string(STRIP ${AMORE_STATICLIBS} AMORE_STATICLIBS)
46     string(REPLACE "\n" " " AMORE_STATICLIBS ${AMORE_STATICLIBS})
47
48     # Checking AMORE auxiliary libraries
49     execute_process(COMMAND ${AMORE_CONFIG} --auxlibs OUTPUT_VARIABLE AMORE_AUXLIBS ERROR_VARIABLE error OUTPUT_STRIP_TRAILING_WHITESPACE )
50     if(error)
51         message(FATAL_ERROR "Error retrieving AMORE auxiliary libraries : ${error}")
52     endif(error)
53     string(STRIP ${AMORE_AUXLIBS} AMORE_AUXLIBS)
54
55     # Checking AMORE cflags
56     execute_process(COMMAND ${AMORE_CONFIG} --cflags OUTPUT_VARIABLE AMORE_CFLAGS ERROR_VARIABLE error OUTPUT_STRIP_TRAILING_WHITESPACE )
57     if(error)
58         message(FATAL_ERROR "Error retrieving AMORE cflags : ${error}")
59     endif(error)
60     
61     if(AMORE_CFLAGS)
62         string(STRIP ${AMORE_CFLAGS} AMORE_CFLAGS)
63     endif(AMORE_CFLAGS)
64
65     # Checking AMORE cflags
66     execute_process(COMMAND ${AMORE_CONFIG} --include-dir OUTPUT_VARIABLE AMORE_INCLUDE_DIR ERROR_VARIABLE error OUTPUT_STRIP_TRAILING_WHITESPACE )
67     if(error)
68         message(FATAL_ERROR "Error retrieving AMORE include directory : ${error}")
69     endif(error)
70     
71     if(AMORE_INCLUDE_DIR)
72         string(STRIP ${AMORE_INCLUDE_DIR} AMORE_INCLUDE_DIR)
73     endif(AMORE_INCLUDE_DIR)
74
75
76     set(AMORE_DEFINITIONS "-DALI_AMORE")
77     set(AMORE_FOUND TRUE)
78
79 endif(AMORE_CONFIG)