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