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