Find the right gfortran libs
[u/mrichter/AliRoot.git] / cmake / CMakemacosx64.cmake
CommitLineData
fc03a176 1# -*- mode: cmake -*-
2
03d1e24f 3#--------------------------------------------------------------------------------#
4# Package File for #
5# Author : Johny Jose (johny.jose@cern.ch) #
6# Variables Defined : #
7# #
8# SRCS - C++ source files #
9# HDRS - C++ header files #
10# DHDR - ROOT Dictionary Linkdef header file #
11# CSRCS - C source files #
12# CHDRS - C header files #
13# EINCLUDE - Include directories #
14# EDEFINE - Compiler definitions #
15# ELIBS - Extra libraries to link #
16# ELIBSDIR - Extra library directories #
17# PACKFFLAGS - Fortran compiler flags for package #
18# PACKCXXFLAGS - C++ compiler flags for package #
19# PACKCFLAGS - C compiler flags for package #
20# PACKSOFLAGS - Shared library linking flags #
21# PACKLDFLAGS - Module linker flags #
22# PACKBLIBS - Libraries to link (Executables only) #
23# EXPORT - Header files to be exported #
24# CINTHDRS - Dictionary header files #
25# CINTAUTOLINK - Set automatic dictionary generation #
26# ARLIBS - Archive Libraries and objects for linking (Executables only) #
27# SHLIBS - Shared Libraries and objects for linking (Executables only) #
28#--------------------------------------------------------------------------------#
29
30execute_process (COMMAND sw_vers | sed -n 's/ProductVersion://p' | cut -d. -f1
31 OUTPUT_VARIABLE MACOSX_MAJOR
32 OUTPUT_STRIP_TRAILING_WHITESPACE )
33execute_process (COMMAND sw_vers | sed -n 's/ProductVersion://p' | cut -d. -f2
34 OUTPUT_VARIABLE MACOSX_MINOR
35 OUTPUT_STRIP_TRAILING_WHITESPACE )
36
37set(FINK_ROOT $ENV{FINK_ROOT})
38if( NOT FINK_ROOT )
39
40 set ( FINK_ROOT /usr/local)
41
42endif( NOT FINK_ROOT )
43
44set ( OPT "-O -g")
45set ( NOOPT "-O0 -g")
46
47set ( CXXOPT ${OPT})
48set ( CXXNOOPT ${NOOPT})
49set ( COPT ${OPT})
50
51if( F77 MATCHES "g95")
52
53 set ( FOPT "${FOPT} -fbounds-check")
54
55endif( F77 MATCHES "g95")
56
57set ( CLIBDEFS "-DCERNLIB_LXIA64 -DCERNLIB_BLDLIB -DCERNLIB_CZ -DCERNLIB_PPC")
58set ( CLIBCXXOPTS )
59set ( CLIBCOPT )
60set ( CLIBFOPT ${CLIBDEFS})
61
85f00ca2 62set ( CXXWARN "-Wall -Wconversion -Wno-long-long -W -Weffc++ -Wshadow -Woverloaded-virtual -ansi")
03d1e24f 63
64set ( CXXSTF "-pipe -fbounds-check -fsigned-char -fno-common -fmessage-length=0 -fno-default-inline -fno-inline -I/usr/X11R6/include -I${FINK_ROOT}/include")
65
66set ( CXXFLAGS "${CXXOPT} ${CXXSTF}")
67
68set ( CXXFLAGSNO "${CXXNOOPT} ${CXXSTF}")
69
70set ( CFLAGS "${COPT} -Wall -W -fno-common -pipe -I${FINK_ROOT}/include")
71
72if(F77 MATCHES "g95")
73
74 set ( FFLAGS "${FFLAGS} -ftrace=full")
75 set ( FFLAGS "${FFLAGS} -DFORTRAN_G95")
76
77else()
78
79 set ( FFLAGS "${FFLAGS} -DFORTRAN_GFORTRAN")
80
81endif(F77 MATCHES "g95")
82
83set ( CINTFLAGS )
84
85set ( LDFLAGS "${OPT} ${DICTLOAD}")
86
87set ( SOFLAGS "-m64 -dynamiclib -undefined dynamic_lookup -single_module")
88
89set ( ALLIB )
90
91set ( SYSLIBS "-L/usr/X11R6/lib -lX11")
92
93
94set ( EXEFLAGS "-bind_at_load")
95
96if( F77 MATCHES "g95")
97
98 execute_process(COMMAND ${CMAKE_Fortran_COMPILER} --print-search-dirs
99 OUTPUT_VARIABLE SYSLIBS
100 OUTPUT_STRIP_TRAILING_WHITESPACE)
101 string(REGEX MATCH "^.*install:[^\n]*" SYSLIBS ${SYSLIBS})
102 string(REGEX REPLACE "^.*install: " "" SYSLIBS ${SYSLIBS})
103 set(SYSLIBS "-L${SHLIB} -lf95")
104 set(DYLIB ${SYSLIBS})
105
106else()
a9fc72d7 107
108 execute_process(COMMAND ${CMAKE_Fortran_COMPILER} -m64 -print-file-name=libgfortran.dylib
03d1e24f 109 OUTPUT_VARIABLE _shlib
110 OUTPUT_STRIP_TRAILING_WHITESPACE)
a9fc72d7 111 execute_process(COMMAND ${CMAKE_Fortran_COMPILER} -m64 -print-file-name=libgfortranbegin.a
03d1e24f 112 OUTPUT_VARIABLE _alib
113 OUTPUT_STRIP_TRAILING_WHITESPACE)
114 set( SYSLIBS "${SYSLIBS} -ldl ${_shlib} ${_alib}")
115
116endif(F77 MATCHES "g95")