feat: 增加安全编译选项

增加gcc/g++安全编译选项,提高编译阶段安全性

Log: 增加安全编译选项
Task: https://pms.uniontech.com/zentao/story-view-13331.html
Influence: 编译安全性
Change-Id: I324b36ddc0214af27cba65b4687c841c696b0b13
This commit is contained in:
weizhixinag 2021-10-25 13:38:56 +08:00 committed by weizhixiang
parent 5c7e5ffefc
commit 0181e8f10b

View File

@ -13,6 +13,9 @@ set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_FLAGS "-g -Wall")
#
ADD_DEFINITIONS("-fstack-protector-strong -D_FORTITY_SOURCE=1 -z noexecstack -pie -fPIC -z lazy")
if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "mips64")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -ftree-vectorize -march=loongson3a -mhard-float -mno-micromips -mno-mips16 -flax-vector-conversions -mloongson-ext2 -mloongson-mmi -fPIE")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie")