-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCMakeLists-cflags.txt
33 lines (28 loc) · 2.03 KB
/
CMakeLists-cflags.txt
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
set( CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE )
set( CMAKE_VERBOSE_MAKEFILE TRUE )
# /Gd Uses the __cdecl calling convention (x86 only).
# /Gr Uses the __fastcall calling convention (x86 only).
# /Gv Uses the __vectorcall calling convention. (x86 and x64 only)
# /Gz Uses the __stdcall calling convention (x86 only).
set( CXX_WARN "-Wall -Wno-float-equal -Wno-padded -Wno-comment ")
set( CLANG_WARN "-Wno-alloca -Wno-cast-align -Wno-cast-qual -Wno-conversion -Wno-c++2a-compat -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-format-nonliteral -Wno-implicit-fallthrough -Wno-documentation -Wno-float-equal -Wno-padded -Wno-reserved-id-macro -Wno-unreachable-code-break -Wno-unused-macros -Wno-switch-enum -Wno-sign-conversion -Wno-signed-enum-bitfield -Wno-weak-vtables ")
set( VS_WARN "")
if( CMAKE_CXX_COMPILER_ID MATCHES "GNU" )
set( CMAKE_CXX_FLAGS "-std=c++11 ${CXX_WARN}" )
set( CMAKE_CXX_FLAGS_RELEASE "-fPIC -O2 -g " )
set( CMAKE_CXX_FLAGS_DEBUG "-fPIC -O0 -ggdb " )
elseif( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
set( CMAKE_CXX_FLAGS "-std=c++11 -stdlib=libc++ ${CLANG_WARN}" )
set( CMAKE_CXX_FLAGS_RELEASE "-fPIC -Os -g -fcolor-diagnostics " )
set( CMAKE_CXX_FLAGS_DEBUG "-fPIC -O0 -gfull -fcolor-diagnostics " )
elseif( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" )
set( CMAKE_CXX_FLAGS " ${VS_WARN} /sdl" )
set( CMAKE_CXX_FLAGS_RELEASE "/nologo /GS /Gy /GF /W4 /EHsc /bigobj /D_WINDOWS /D_SCL_SECURE_NO_WARNINGS /DHAVE_STRING_H /DNO_GETTIMEOFDAY /DYAML_DECLARE_STATIC /DPCRE_STATIC /O2 /MD /Zo " )
set( CMAKE_CXX_FLAGS_DEBUG "/nologo /GS /Gy /GF /W4 /EHsc /bigobj /D_WINDOWS /D_SCL_SECURE_NO_WARNINGS /DHAVE_STRING_H /DNO_GETTIMEOFDAY /DYAML_DECLARE_STATIC /DPCRE_STATIC /Od /Ob0 /MDd /guard:cf /Zi /DEBUG:FULL " )
else()
message( FATAL_ERROR "Unsupported compiler ${CMAKE_CXX_COMPILER_ID}")
endif()
message( STATUS "Compiler used: ${CMAKE_CXX_COMPILER_ID}")
set( CMAKE_C_FLAGS "" )
set( CMAKE_C_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE} )
set( CMAKE_C_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG} )