Additional security flags for Linux builds

This commit is contained in:
Alexandru Geana 2023-07-17 13:59:15 +02:00
parent 188a58dd7d
commit e087f6f21c
No known key found for this signature in database
GPG Key ID: 7B02578FC8E45306

View File

@ -30,8 +30,15 @@ endif()
function(APPLY_STANDARD_SETTINGS TARGET) function(APPLY_STANDARD_SETTINGS TARGET)
target_compile_features(${TARGET} PUBLIC cxx_std_14) target_compile_features(${TARGET} PUBLIC cxx_std_14)
target_compile_options(${TARGET} PRIVATE -Wall -Werror) target_compile_options(${TARGET} PRIVATE -Wall -Werror)
target_compile_options(${TARGET} PRIVATE -fstack-protector-all)
target_compile_options(${TARGET} PRIVATE -fpie)
target_compile_options(${TARGET} PRIVATE -fpic)
target_compile_options(${TARGET} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:-O3>") target_compile_options(${TARGET} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:-O3>")
target_compile_definitions(${TARGET} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:NDEBUG>") target_compile_definitions(${TARGET} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:NDEBUG>")
target_link_options(${TARGET} PRIVATE -fstack-protector-all)
target_link_options(${TARGET} PRIVATE -pie)
target_link_options(${TARGET} PRIVATE -Wl,-z,noexecstack)
target_link_options(${TARGET} PRIVATE -Wl,-z,relro,-z,now)
endfunction() endfunction()
set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")