forked from wdl83/H.265Insight
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFlags.cmake
57 lines (49 loc) · 2.49 KB
/
Flags.cmake
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
56
57
IF(USE_CLANG)
# C++ compiler flags
SET(CMAKE_CXX_FLAGS "-std=c++11 -Wall -Wextra -Wshadow -Wno-parentheses -pedantic -Qunused-arguments -fno-exceptions -Wno-unused-local-typedef" )
SET(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -DPTR_CHECK -DBDRY_CHECK -DNUMERIC_CHECK" )
SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -mtune=native -DNO_DEBUG -DNDEBUG -fPIC -rdynamic -Wno-unused-parameter" )
# C compiler flags
SET(CMAKE_C_FLAGS "-std=c99 -Wall -Wextra")
SET(CMAKE_C_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
SET(CMAKE_C_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
# additional flags
SET(CMAKE_EXE_LINKER_FLAGS "-lstdc++ -lpthread")
ELSE(USE_CLANG)
# C++ compiler flags
SET(CMAKE_CXX_FLAGS "-std=c++11 -pipe -fstack-protector-all -Wall -Wextra -Wno-parentheses -pedantic -Wno-unused-local-typedefs -fdiagnostics-color=always -fno-exceptions" )
SET(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -fno-omit-frame-pointer -DPTR_CHECK -DBDRY_CHECK -DNUMERIC_CHECK" )
SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -mtune=native -DNO_DEBUG -DNDEBUG -fPIC -rdynamic -Wno-unused-parameter" )
# C compiler flags
SET(CMAKE_C_FLAGS "-std=c99 -Wall -Wextra")
SET(CMAKE_C_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
SET(CMAKE_C_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
# additional flags
SET(CMAKE_EXE_LINKER_FLAGS "-lstdc++ -lpthread")
ENDIF(USE_CLANG)
OPTION(ENABLE_ASAN "Enable Address Sanitizer" OFF)
OPTION(ENABLE_UBSAN "Enable Undefined Behavior Sanitizer" OFF)
OPTION(ENABLE_DBGSYMS "Enable debug symbols in RELEASE build" OFF)
OPTION(ENABLE_GPROF "Enable GNU Pofiler" OFF)
IF(ENABLE_ASAN)
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=address")
ENDIF(ENABLE_ASAN)
IF(ENABLE_UBSAN)
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=undefined")
ENDIF(ENABLE_UBSAN)
IF(ABORT_ON_SEI_HASH_MISMATCH)
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DABORT_ON_SEI_HASH_MISMATCH")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DABORT_ON_SEI_HASH_MISMATCH")
ENDIF(ABORT_ON_SEI_HASH_MISMATCH)
IF(BDRY_CHECK)
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DBDRY_CHECK")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DBDRY_CHECK")
ENDIF(BDRY_CHECK)
IF(ENABLE_DBGSYMS)
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -g")
ENDIF(ENABLE_DBGSYMS)
IF(ENABLE_GPROF)
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -pg")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg")
ENDIF(ENABLE_GPROF)
SET(CMAKE_EXPORT_COMPILE_COMMANDS "ON")