1 #--------------------------------------------------------------------------------#
2 # Linux CMake System configuration file for the AliRoot Build System #
4 # Author: Johny Jose (johny.jose@cern.ch) #
6 #--------------------------------------------------------------------------------#
9 cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
11 #Retrieve Compiler Version
13 if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
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)
22 endif(CMAKE_C_COMPILER_ID STREQUAL "GNU")
34 set(CLIBDEFS "-DCERNLIB_LINUX -DCERNLIB_BLDLIB -DCERNLIB_CZ")
37 set(CLIBFOPT ${CLIBDEFS})
39 set(CXXWARN "-Wall -Wno-long-long -W -Weffc++ -Wshadow -Woverloaded-virtual -ansi")
41 if(CCMAJORV STREQUAL "2")
43 set(CXXFLAGS "${OPT} -fPIC -pipe")
44 set(CXXFLAGSNO "${NOOPT} -fPIC -pipe")
46 elseif(CCMAJORV STREQUAL "3")
48 set(CXXFLAGS "${OPT} -fPIC -pipe -fmessage-length=0")
49 add_definitions(-Dlinux)
50 set(CXXFLAGSNO "${NOOPT} -fPIC -pipe -fmessage-length=0")
52 elseif(CCMAJORV STREQUAL "4")
54 set(CXXFLAGS "${OPT} -fPIC -pipe -fmessage-length=0")
55 add_definitions(-Dlinux)
56 set(CXXFLAGSNO "${NOOPT} -fPIC -pipe -fmessage-length=0")
60 set(CXXFLAGS "${OPT} -pipe -fmessage-length=0")
61 add_definitions(-Dlinux)
62 set(CXXFLAGSNO "${NOOPT} -pipe -fmessage-length=0")
64 endif(CCMAJORV STREQUAL "2")
66 set(CFLAGS "${OPT} -Wall -Werror -fPIC -pipe -Wno-long-long -pedantic-errors -ansi")
67 set(FFLAGS "${CLIBFOPT} ${FOPT} -fPIC -fno-second-underscore")
69 set(SYSLIBS "-ldl -lcrypt -L/usr/X11R6/lib -lX11")
71 if(${CMAKE_Fortran_COMPILER} MATCHES "g95")
73 add_definitions(-DFORTRAN_G95)
74 execute_process(COMMAND ${CMAKE_Fortran_COMPILER} --print-search-dirs
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")
81 elseif(${CMAKE_Fortran_COMPILER} MATCHES "gfortran")
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
89 OUTPUT_STRIP_TRAILING_WHITESPACE)
90 set(SHLIB "${_shlib} ${SHLIB}")
91 set(SYSLIBS "${SYSLIBS} ${SHLIB}")
98 endif(${CMAKE_Fortran_COMPILER} MATCHES "g95")
100 set(LDFLAGS "${OPT}")
101 set(SOFLAGS "${OPT} -shared -Wl")