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