Correction for bug #77355: Generation of PARs
[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
9cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
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
23set(OPT "-O -g")
24set(NOOPT "-g")
25
26set(CXXOPT ${OPT})
27set(CXXNOPT ${NOOPT})
28set(COPT ${OPT})
29set(FOPT ${OPT})
30
31#CERNLIB defines
32set(CLIBDEFS "-DCERNLIB_UNIX -DCERNLIBS_DECS -DCERNLIB_BLDLIB -DCERNLIB_CZ")
33set(CLIBCXXOPTS)
34set(CLIBCOPT)
35set(CLIBFOPT ${CLIBDEFS})
36
37set(CXXWARN "-Wall -Wno-long-long -W -Weffc++ -Wshadow -Woverloaded-virtual -ansi")
38
39if(CCMAJORV STREQUAL "2")
40
41 set(CXXFLAGS "${OPT} -fPIC -pipe")
42 set(CXXFLAGSNO "${NOOPT} -fPIC -pipe")
43
44elseif(CCMAJORV STREQUAL "3")
45
46 set(CXXFLAGS "${OPT} -fPIC -pipe -fmessage-length=0 -Dlinux")
47 add_definitions(-Dlinux)
48 set(CXXFLAGSNO "${NOOPT} -fPIC -pipe -fmessage-length=0")
49
50elseif(CCMAJORV STREQUAL "4")
51
52 set(CXXFLAGS "${OPT} -fPIC -pipe -fmessage-length=0 -Dlinux")
53 add_definitions(-Dlinux)
54 set(CXXFLAGSNO "${NOOPT} -fPIC -pipe -fmessage-length=0")
55
56else ()
57
58 set(CXXFLAGS "${OPT} -pipe -fmessage-length=0 -Dlinux")
59 add_definitions(-Dlinux)
60 set(CXXFLAGSNO "${NOOPT} -pipe -fmessage-length=0")
61
62endif(CCMAJORV STREQUAL "2")
63
64set(CFLAGS "${OPT} -Wall -Werror -fPIC -pipe -Wno-long-long -pedantic-errors -ansi")
65set(FFLAGS "${CLIBFOPT} ${FOPT} -fPIC -fno-second-underscore -fPIC -fno-f2c")
66
67execute_process(COMMAND find /lib64 -name 'libNoVersion*.so' | xargs --replace basename {} .so | sed -e 's/lib64/ -l/'
68 OUTPUT_VARIABLE LIBNOVER
69 OUTPUT_STRIP_TRAILING_WHITESPACE)
70
71
72set(SYSLIBS "-ldl -lcrypt -L/usr/X11R6/lib -lX11 ${LIBNOVER}")
73
74if(${CMAKE_Fortran_COMPILER} MATCHES "g95")
75
76 add_definitions(-DFORTRAN_G95)
77 execute_process(COMMAND ${CMAKE_Fortran_COMPILER} --print-search-dirs
78 OUTPUT_VARIABLE SHLIB
79 OUTPUT_STRIP_TRAILING_WHITESPACE)
80 string(REGEX MATCH "^.*install:[^\n]*" SHLIB ${SHLIB})
81 string(REGEX REPLACE "^.*install: " "" SHLIB ${SHLIB})
82 set(SHLIB "-L${SHLIB} -lf95")
83
84elseif(${CMAKE_Fortran_COMPILER} MATCHES "gfortran")
85
86 set(FFLAGS "-DFORTRAN_GFORTRAN ${FFLAGS}")
87 execute_process(COMMAND ${CMAKE_Fortran_COMPILER} -m32 -print-file-name=libgfortran.so
88 OUTPUT_VARIABLE _shlib
89 OUTPUT_STRIP_TRAILING_WHITESPACE)
90 execute_process(COMMAND ${CMAKE_Fortran_COMPILER} -m32 -print-file-name=libgfortranbegin.a
91 OUTPUT_VARIABLE SHLIB
92 OUTPUT_STRIP_TRAILING_WHITESPACE)
93 set(SHLIB "${_shlib} ${SHLIB}")
94 set(SYSLIBS "${SYSLIBS} ${SHLIB}")
95
96else()
97
98 set(SHLIB "-lg2c")
99 set(SYSLIBS "-lg2c")
100
101endif(${CMAKE_Fortran_COMPILER} MATCHES "g95")
102
103set(LDFLAGS "${OPT}")
104set(SOFLAGS "${OPT} -shared -Wl")
105set(ALLIB)
106
107
108