CMake: removing qpythia from the depedencies
[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
73cf8fa9 11cmake_minimum_required(VERSION 2.8.8 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"))
8a94851d 32 set(DEFAULT_CXX_FLAGS "-g")
aecc2ba0 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
af362efe 40set(NOOPT "-g")
6db31708 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")
27878abc 71 if(CCMINORV STRGREATER 5)
72 message("-- GCC version > 4.5 - mask default -Wl,--as-needed")
03f3bd35 73 set(XTRA_LDFLAGS "-Wl,--no-as-needed")
74 endif()
6db31708 75
76else ()
77
78 set(CXXFLAGS "${OPT} -pipe -fmessage-length=0 -Dlinux")
79 add_definitions(-Dlinux)
80 set(CXXFLAGSNO "${NOOPT} -pipe -fmessage-length=0")
81
82endif(CCMAJORV STREQUAL "2")
83
84set(CFLAGS "${OPT} -Wall -Werror -fPIC -pipe -Wno-long-long -pedantic-errors -ansi")
85set(FFLAGS "${CLIBFOPT} ${FOPT} -fPIC -fno-second-underscore -fPIC -fno-f2c")
86
87execute_process(COMMAND find /lib64 -name 'libNoVersion*.so'
88 COMMAND xargs --replace basename {} .so
89 COMMAND sed -e "s/lib64/ -l/"
90 OUTPUT_VARIABLE LIBNOVER
91 OUTPUT_STRIP_TRAILING_WHITESPACE)
92
93
8e08c10e 94#set(SYSLIBS "-ldl -lcrypt -L/usr/X11R6/lib -lX11 -lGL -lGLU ${LIBNOVER}")
95set(SYSLIBS "-ldl -lcrypt -L/usr/X11R6/lib -lX11 ${LIBNOVER}")
6db31708 96
97if(${CMAKE_Fortran_COMPILER} MATCHES "g95")
98
99 add_definitions(-DFORTRAN_G95)
100 execute_process(COMMAND ${CMAKE_Fortran_COMPILER} --print-search-dirs
101 OUTPUT_VARIABLE SHLIB
102 OUTPUT_STRIP_TRAILING_WHITESPACE)
103 string(REGEX MATCH "^.*install:[^\n]*" SHLIB ${SHLIB})
104 string(REGEX REPLACE "^.*install: " "" SHLIB ${SHLIB})
105 set(SHLIB "-L${SHLIB} -lf95")
106
107elseif(${CMAKE_Fortran_COMPILER} MATCHES "gfortran")
108
c2aad3ae 109 set(FFLAGS "-DFORTRAN_GFORTRAN ${FFLAGS} -fPIC")
91fe530b 110 execute_process(COMMAND ${CMAKE_Fortran_COMPILER} -print-file-name=libgfortran.so
6db31708 111 OUTPUT_VARIABLE _shlib
112 OUTPUT_STRIP_TRAILING_WHITESPACE)
91fe530b 113 execute_process(COMMAND ${CMAKE_Fortran_COMPILER} -print-file-name=libgfortranbegin.a
6db31708 114 OUTPUT_VARIABLE SHLIB
115 OUTPUT_STRIP_TRAILING_WHITESPACE)
116 set(SHLIB "${_shlib} ${SHLIB}")
117 set(SYSLIBS "${SYSLIBS} ${SHLIB}")
118
119else()
120
121 set(SHLIB "-lg2c")
122 set(SYSLIBS "-lg2c")
123
124endif(${CMAKE_Fortran_COMPILER} MATCHES "g95")
125
03f3bd35 126set(LDFLAGS "${OPT} ${XTRA_LDFLAGS} ")
127set(SOFLAGS "${OPT} ${XTRA_LDFLAGS} -shared")
6db31708 128set(ALLIB)
129
130
131