Fixed install target
[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
9cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
10
11#Retrieve Compiler Version
12
13if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
14
15 execute_process (COMMAND ${CMAKE_C_COMPILER} -dumpversion | cut -d. -f1
16 OUTPUT_VARIABLE CCMAJORV
17 OUTPUT_STRIP_TRAILING_WHITESPACE)
18 execute_process (COMMAND ${CMAKE_C_COMPILER} -dumpversion | cut -d. -f2
19 OUTPUT_VARIABLE CCMINORV
20 OUTPUT_STRIP_TRAILING_WHITESPACE)
21
22endif(CMAKE_C_COMPILER_ID STREQUAL "GNU")
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")
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")
55 add_definitions(-Dlinux)
56 set(CXXFLAGSNO "${NOOPT} -fPIC -pipe -fmessage-length=0")
57
58else ()
59
60 set(CXXFLAGS "${OPT} -pipe -fmessage-length=0")
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")
68
69set(SYSLIBS "-ldl -lcrypt -L/usr/X11R6/lib -lX11")
70
71if(${CMAKE_Fortran_COMPILER} MATCHES "g95")
72
73 add_definitions(-DFORTRAN_G95)
74 execute_process(COMMAND ${CMAKE_Fortran_COMPILER} --print-search-dirs
75 OUTPUT_VARIABLE SHLIB
76 OUTPUT_STRIP_TRAILING_WHITESPACE)
77 string(REGEX MATCH "^.*install:[^\n]*" SHLIB ${SHLIB})
78 string(REGEX REPLACE "^.*install: " "" SHLIB ${SHLIB})
79 set(SHLIB "-L${SHLIB} -lf95")
80
81elseif(${CMAKE_Fortran_COMPILER} MATCHES "gfortran")
82
83 set(FFLAGS "-DFORTRAN_GFORTRAN ${FFLAGS}")
84 execute_process(COMMAND ${CMAKE_Fortran_COMPILER} -m32 -print-file-name=libgfortran.so
85 OUTPUT_VARIABLE _shlib
86 OUTPUT_STRIP_TRAILING_WHITESPACE)
87 execute_process(COMMAND ${CMAKE_Fortran_COMPILER} -m32 -print-file-name=libgfortranbegin.a
88 OUTPUT_VARIABLE SHLIB
89 OUTPUT_STRIP_TRAILING_WHITESPACE)
90 set(SHLIB "${_shlib} ${SHLIB}")
91 set(SYSLIBS "${SYSLIBS} ${SHLIB}")
92
93else()
94
95 set(SHLIB "-lg2c")
96 set(SYSLIBS "-lg2c")
97
98endif(${CMAKE_Fortran_COMPILER} MATCHES "g95")
99
100set(LDFLAGS "${OPT}")
101set(SOFLAGS "${OPT} -shared -Wl")
102set(ALLIB)
103
104
105