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