source: PSPA/madxPSPA/cmake/compilers/setupGNU.cmake @ 478

Last change on this file since 478 was 430, checked in by touze, 11 years ago

import madx-5.01.00

File size: 1.3 KB
Line 
1
2###
3#
4# This file sets up specific flags for the GNU compiler
5#
6###
7
8if (CMAKE_Fortran_COMPILER_ID MATCHES "GNU")
9    # General:
10    set(CMAKE_Fortran_FLAGS " -fno-range-check -fno-f2c -cpp ") # remove -g -O2 from main list
11    execute_process(COMMAND ${CMAKE_Fortran_COMPILER} --version OUTPUT_VARIABLE CMAKE_Fortran_COMPILER_VERSION)
12    string(REGEX MATCH "[3-5].[0-9].[0-9]" CMAKE_Fortran_COMPILER_VERSION ${CMAKE_Fortran_COMPILER_VERSION})
13    if(${CMAKE_Fortran_COMPILER_VERSION} VERSION_GREATER 4.3.9)
14        add_definitions(-D_GFORTRAN)
15    endif()
16    # Release flags:
17    # ON APPLE machines and on 32bit Linux systems, -O2 seems to be the highest optimization level possible
18    # for file l_complex_taylor.f90
19    if(APPLE OR ${CMAKE_SIZEOF_VOID_P} EQUAL 4)
20        set(CMAKE_Fortran_FLAGS_RELEASE " -funroll-loops -O2 ")
21    else()
22        set(CMAKE_Fortran_FLAGS_RELEASE " -funroll-loops -O4 ")
23    endif()
24
25    # Additional option dependent flags:
26    if ( MADX_STATIC )
27        set(CMAKE_Fortran_LINK_FLAGS   "${CMAKE_Fortran_LINK_FLAGS} -static ")
28    endif ()
29    if(IS32BIT)
30        set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -m32")
31    endif()
32    set(CMAKE_Fortran_FLAGS_DEBUG   " -Wall ${CMAKE_Fortran_FLAGS_DEBUG}")
33endif()
34if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
35    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++98")
36endif()
Note: See TracBrowser for help on using the repository browser.