File: compiler.cmake

package info (click to toggle)
sdcv 0.5.5-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 596 kB
  • sloc: cpp: 3,082; sh: 226; xml: 23; makefile: 10
file content (22 lines) | stat: -rw-r--r-- 760 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
function(append value)
  foreach(variable ${ARGN})
    set(${variable} "${${variable}} ${value}" PARENT_SCOPE)
  endforeach(variable)
endfunction()

include(CheckCXXCompilerFlag)

if (NOT DEFINED SDCV_COMPILER_IS_GCC_COMPATIBLE)
  if (CMAKE_COMPILER_IS_GNUCXX)
    set(SDCV_COMPILER_IS_GCC_COMPATIBLE ON)
  elseif (MSVC)
    set(SDCV_COMPILER_IS_GCC_COMPATIBLE OFF)
  elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
    set (SDCV_COMPILER_IS_GCC_COMPATIBLE ON)
  endif()
endif()

if (SDCV_COMPILER_IS_GCC_COMPATIBLE)
  append("-Wall" "-Wextra" "-Wformat-security" "-Wcast-align" "-Werror=format" "-Wcast-qual" CMAKE_C_FLAGS)
  append("-Wall" "-pedantic" "-Wextra" "-Wformat-security" "-Wcast-align" "-Werror=format" "-Wcast-qual" CMAKE_CXX_FLAGS)
endif ()