CXXCompilerSettings.cmake 1.73 KB
Newer Older
Martin Köhler's avatar
Martin Köhler committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=64)
IF(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
    # GNU
    SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -Wunused -g ")
    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
    IF(INTEGER8 STREQUAL ON)
        ADD_DEFINITIONS(-DINTEGER8)
    ENDIF()
    IF(HOSTOPT STREQUAL ON)
        SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -mtune=native")
    ENDIF()

ELSEIF(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
    # Intel
    SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -w2 -g")
    SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")
    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")

    IF(INTEGER8 STREQUAL ON)
        ADD_DEFINITIONS(-DINTEGER8)
    ENDIF()

    IF(HOSTOPT STREQUAL ON)
        SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -xHost")
    ENDIF()

ELSEIF(CMAKE_Fortran_COMPILER_ID STREQUAL "PGI")
    # PGI
    SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O4 ")
    SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -Minfo=all")
    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -fpic")

    IF(INTEGER8 STREQUAL ON)
        ADD_DEFINITIONS(-DINTEGER8)
    ENDIF()

ELSEIF(CMAKE_Fortran_COMPILER_ID STREQUAL "XL")
    # IBM XL
    IF(HOSTOPT STREQUAL ON)
        SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O5 -qtune=auto -qarch=auto")
    ELSE()
        SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")
    ENDIF()
    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -qpic")
    STRING(REPLACE "-qhalt=e" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")

    IF(INTEGER8 STREQUAL ON)
        ADD_DEFINITIONS(-DINTEGER8)
    ENDIF()

    IF(OPENMP_FOUND)
        LIST(REMOVE_ITEM CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "xlomp_ser")
    ENDIF()
ENDIF()