-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathext_cmake_compiler_specific.cmake
More file actions
42 lines (40 loc) · 2.37 KB
/
ext_cmake_compiler_specific.cmake
File metadata and controls
42 lines (40 loc) · 2.37 KB
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
macro(ext_define_warning_flags)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(ext_basic-warnings -Wall -Wextra -Wpedantic)
set(ext_more-warnings ${ext_basic-warnings} -Wcast-align -Wcast-qual -Wconversion)
set(ext_stone-warnings ${ext_more-warnings} -Wctor-dtor-privacy)
set(ext_stone-warnings ${ext_stone-warnings} -Wdisabled-optimization -Wdouble-promotion)
set(ext_stone-warnings ${ext_stone-warnings} -Wfloat-equal -Wformat=2 -Winit-self -Winvalid-pch)
set(ext_stone-warnings ${ext_stone-warnings} -Wlogical-op -Wmissing-include-dirs)
set(ext_stone-warnings ${ext_stone-warnings} -Wnoexcept -Wold-style-cast -Woverloaded-virtual -Wredundant-decls)
set(ext_stone-warnings ${ext_stone-warnings} -Wshadow -Wsign-conversion -Wsign-promo)
set(ext_stone-warnings ${ext_stone-warnings} -Wstrict-null-sentinel -Wstrict-overflow=5)
set(ext_stone-warnings ${ext_stone-warnings} -Wtrampolines -Wunsafe-loop-optimizations)
set(ext_stone-warnings ${ext_stone-warnings} -Wvector-operation-performance)
set(ext_stone-warnings ${ext_stone-warnings} -Wzero-as-null-pointer-constant)
set(ext_stone-warnings-extra ${ext_stone-warnings} -Wundef -Wmissing-declarations)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(ext_basic-warnings -Wall -Wextra -Wpedantic)
set(ext_more-warnings ${ext_basic-warnings} -Wcast-align -Wcast-qual -Wconversion)
set(ext_stone-warnings ${ext_more-warnings})
set(ext_stone-warnings-extra ${ext_stone-warnings})
else()
message(STATUS "Flags for your compiler(${CMAKE_COMPILER_IS}) are not defined. Please update compiler-warnings.cmake")
set(ext_basic-warnings )
set(ext_more-warnings ${ext_basic-warnings})
set(ext_stone-warnings ${ext_more-warnings})
set(ext_stone-warnings-extra ${ext_stone-warnings})
endif()
endmacro(ext_define_warning_flags)
macro(ext_colored_compiler_ouput use_color)
if(NOT DEFINED EXT_COLORED_OUTPUT)
set(EXT_COLORED_OUTPUT ${use_color} CACHE BOOL "Use colored compiler output.")
endif()
if(EXT_COLORED_OUTPUT)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
add_compile_options (-fdiagnostics-color=always)
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
add_compile_options (-fcolor-diagnostics)
endif ()
endif ()
endmacro(ext_colored_compiler_ouput)