Wrong commit before -
[u/mrichter/AliRoot.git] / cmake / CMakelinuxx8664gcc.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_LINUX -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'
68 COMMAND xargs --replace basename {} .so
69 COMMAND sed -e "s/lib64/ -l/"
70 OUTPUT_VARIABLE LIBNOVER
71 OUTPUT_STRIP_TRAILING_WHITESPACE)
72
73
74set(SYSLIBS "-ldl -lcrypt -L/usr/X11R6/lib -lX11 ${LIBNOVER}")
75
76if(${CMAKE_Fortran_COMPILER} MATCHES "g95")
77
78 add_definitions(-DFORTRAN_G95)
79 execute_process(COMMAND ${CMAKE_Fortran_COMPILER} --print-search-dirs
80 OUTPUT_VARIABLE SHLIB
81 OUTPUT_STRIP_TRAILING_WHITESPACE)
82 string(REGEX MATCH "^.*install:[^\n]*" SHLIB ${SHLIB})
83 string(REGEX REPLACE "^.*install: " "" SHLIB ${SHLIB})
84 set(SHLIB "-L${SHLIB} -lf95")
85
86elseif(${CMAKE_Fortran_COMPILER} MATCHES "gfortran")
87
88 set(FFLAGS "-DFORTRAN_GFORTRAN ${FFLAGS}")
91fe530b 89 execute_process(COMMAND ${CMAKE_Fortran_COMPILER} -print-file-name=libgfortran.so
6db31708 90 OUTPUT_VARIABLE _shlib
91 OUTPUT_STRIP_TRAILING_WHITESPACE)
91fe530b 92 execute_process(COMMAND ${CMAKE_Fortran_COMPILER} -print-file-name=libgfortranbegin.a
6db31708 93 OUTPUT_VARIABLE SHLIB
94 OUTPUT_STRIP_TRAILING_WHITESPACE)
95 set(SHLIB "${_shlib} ${SHLIB}")
96 set(SYSLIBS "${SYSLIBS} ${SHLIB}")
97
98else()
99
100 set(SHLIB "-lg2c")
101 set(SYSLIBS "-lg2c")
102
103endif(${CMAKE_Fortran_COMPILER} MATCHES "g95")
104
105set(LDFLAGS "${OPT}")
106set(SOFLAGS "${OPT} -shared -Wl")
107set(ALLIB)
108
109
110