Adding ruleckecher files into the distribbution
[u/mrichter/AliRoot.git] / cmake / CMakelinuxalphagcc.cmake
CommitLineData
6db31708 1#--------------------------------------------------------------------------------#
2# Linuxx8664gcc CMake System configuration file for the AliRoot Build System #
3# #
4# Author: Johny Jose (johny.jose@cern.ch) #
5# #
6#--------------------------------------------------------------------------------#
7
8
6b06712c 9cmake_minimum_required(VERSION 2.8.4 FATAL_ERROR)
6db31708 10
11#Retrieve Compiler Version
12
13
14execute_process (COMMAND ${CMAKE_C_COMPILER} -dumpversion | cut -d. -f1
15 OUTPUT_VARIABLE CCMAJORV
16 OUTPUT_STRIP_TRAILING_WHITESPACE)
17execute_process (COMMAND ${CMAKE_C_COMPILER} -dumpversion | cut -d. -f2
18 OUTPUT_VARIABLE CCMINORV
19 OUTPUT_STRIP_TRAILING_WHITESPACE)
20
21
22# Global Optimization
aecc2ba0 23set(OPT)
24# ------- Setting optimization flags for default configuration -------
25if((NOT CMAKE_BUILD_TYPE) OR (CMAKE_BUILD_TYPE STREQUAL "None"))
26 set(DEFAULT_CXX_FLAGS "-O -g")
27 set(OPT "${DEFAULT_CXX_FLAGS}")
28 message("-- Setting compiler flags for default configuration: ${DEFAULT_CXX_FLAGS}")
29endif((NOT CMAKE_BUILD_TYPE) OR (CMAKE_BUILD_TYPE STREQUAL "None"))
30# --------------------------------------------------------------------
6db31708 31set(NOOPT "-g")
32
33set(CXXOPT ${OPT})
34set(CXXNOPT ${NOOPT})
35set(COPT ${OPT})
36set(FOPT ${OPT})
37
38#CERNLIB defines
39set(CLIBDEFS "-DCERNLIB_UNIX -DCERNLIBS_DECS -DCERNLIB_BLDLIB -DCERNLIB_CZ")
40set(CLIBCXXOPTS)
41set(CLIBCOPT)
42set(CLIBFOPT ${CLIBDEFS})
43
44set(CXXWARN "-Wall -Wno-long-long -W -Weffc++ -Wshadow -Woverloaded-virtual -ansi")
45
46if(CCMAJORV STREQUAL "2")
47
48 set(CXXFLAGS "${OPT} -fPIC -pipe")
49 set(CXXFLAGSNO "${NOOPT} -fPIC -pipe")
50
51elseif(CCMAJORV STREQUAL "3")
52
53 set(CXXFLAGS "${OPT} -fPIC -pipe -fmessage-length=0 -Dlinux")
54 add_definitions(-Dlinux)
55 set(CXXFLAGSNO "${NOOPT} -fPIC -pipe -fmessage-length=0")
56
57elseif(CCMAJORV STREQUAL "4")
58
59 set(CXXFLAGS "${OPT} -fPIC -pipe -fmessage-length=0 -Dlinux")
60 add_definitions(-Dlinux)
61 set(CXXFLAGSNO "${NOOPT} -fPIC -pipe -fmessage-length=0")
62
63else ()
64
65 set(CXXFLAGS "${OPT} -pipe -fmessage-length=0 -Dlinux")
66 add_definitions(-Dlinux)
67 set(CXXFLAGSNO "${NOOPT} -pipe -fmessage-length=0")
68
69endif(CCMAJORV STREQUAL "2")
70
71set(CFLAGS "${OPT} -Wall -Werror -fPIC -pipe -Wno-long-long -pedantic-errors -ansi")
72set(FFLAGS "${CLIBFOPT} ${FOPT} -fPIC -fno-second-underscore -fPIC -fno-f2c")
73
74execute_process(COMMAND find /lib64 -name 'libNoVersion*.so' | xargs --replace basename {} .so | sed -e 's/lib64/ -l/'
75 OUTPUT_VARIABLE LIBNOVER
76 OUTPUT_STRIP_TRAILING_WHITESPACE)
77
78
79set(SYSLIBS "-ldl -lcrypt -L/usr/X11R6/lib -lX11 ${LIBNOVER}")
80
81if(${CMAKE_Fortran_COMPILER} MATCHES "g95")
82
83 add_definitions(-DFORTRAN_G95)
84 execute_process(COMMAND ${CMAKE_Fortran_COMPILER} --print-search-dirs
85 OUTPUT_VARIABLE SHLIB
86 OUTPUT_STRIP_TRAILING_WHITESPACE)
87 string(REGEX MATCH "^.*install:[^\n]*" SHLIB ${SHLIB})
88 string(REGEX REPLACE "^.*install: " "" SHLIB ${SHLIB})
89 set(SHLIB "-L${SHLIB} -lf95")
90
91elseif(${CMAKE_Fortran_COMPILER} MATCHES "gfortran")
92
93 set(FFLAGS "-DFORTRAN_GFORTRAN ${FFLAGS}")
94 execute_process(COMMAND ${CMAKE_Fortran_COMPILER} -m32 -print-file-name=libgfortran.so
95 OUTPUT_VARIABLE _shlib
96 OUTPUT_STRIP_TRAILING_WHITESPACE)
97 execute_process(COMMAND ${CMAKE_Fortran_COMPILER} -m32 -print-file-name=libgfortranbegin.a
98 OUTPUT_VARIABLE SHLIB
99 OUTPUT_STRIP_TRAILING_WHITESPACE)
100 set(SHLIB "${_shlib} ${SHLIB}")
101 set(SYSLIBS "${SYSLIBS} ${SHLIB}")
102
103else()
104
105 set(SHLIB "-lg2c")
106 set(SYSLIBS "-lg2c")
107
108endif(${CMAKE_Fortran_COMPILER} MATCHES "g95")
109
110set(LDFLAGS "${OPT}")
111set(SOFLAGS "${OPT} -shared -Wl")
112set(ALLIB)
113
114
115