File: FindCompilerFlagsSet.cmake

package info (click to toggle)
freealut 1.1.0-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,148 kB
  • sloc: sh: 8,617; ansic: 2,738; makefile: 89
file content (34 lines) | stat: -rw-r--r-- 1,215 bytes parent folder | download | duplicates (9)
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
IF(CMAKE_COMPILER_IS_GNUCC)
  #ADD_DEFINITIONS(-std=c99)

  IF(WARNINGS)
    SET(ADD_WFLAGS "${ADD_WFLAGS} -Wall -ansi -pedantic -W")

    IF(MORE_WARNINGS)
      SET(ADD_WFLAGS "${ADD_WFLAGS} -Waggregate-return -Wbad-function-cast -Wcast-align -Wcast-qual -Wdisabled-optimization -Wendif-labels -Winline -Wlong-long -Wmissing-declarations -Wmissing-noreturn -Wmissing-prototypes -Wnested-externs -Wpacked -Wpointer-arith -Wredundant-decls -Wshadow -Wsign-compare -Wstrict-prototypes -Wwrite-strings")
    ENDIF(MORE_WARNINGS)

    # Should we use turn warnings into errors?
    IF(USE_WERROR)
      SET(ADD_WFLAGS "${ADD_WFLAGS} -Werror -pedantic-errors")
    ENDIF(USE_WERROR)
  ENDIF(WARNINGS)

  IF(OPTIMIZATION)
    SET(ADD_CFLAGS "${ADD_CFLAGS} -O2 -finline-functions -ffast-math")
  ENDIF(OPTIMIZATION)

  IF(PROFILE)
    SET(ADD_CFLAGS "${ADD_CFLAGS} -pg")
    SET(ADD_LDFLAGS "-pg")
  ELSE(PROFILE)

    IF(OPTIMIZATION)
      # -pg and -fomit-frame-pointer are incompatible
      SET(ADD_CFLAGS "${ADD_CFLAGS} -fomit-frame-pointer")
    ENDIF(OPTIMIZATION)
  ENDIF(PROFILE)
ELSE(CMAKE_COMPILER_IS_GNUCC)

  MESSAGE("Your compiler isn't fully supported yet - no flags set.")
ENDIF(CMAKE_COMPILER_IS_GNUCC)