mirror of
https://github.com/google/sandboxed-api.git
synced 2024-03-22 13:11:30 +08:00
Force -fno-exceptions compiler option.
Add hardening compiler options (enabled via SAPI_HARDENED_SOURCE) PiperOrigin-RevId: 347081406 Change-Id: I6c293a95a3bb05ea3b581bd9497381847c7aa510
This commit is contained in:
parent
13ff7a42da
commit
d172411d7b
|
@ -47,7 +47,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|||
# Allow the header generator to auto-configure include paths
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
if (SAPI_FORCE_COLOR_OUTPUT)
|
||||
if(SAPI_FORCE_COLOR_OUTPUT)
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") # GCC
|
||||
add_compile_options(-fdiagnostics-color=always)
|
||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") # Clang or Apple Clang
|
||||
|
@ -55,6 +55,13 @@ if (SAPI_FORCE_COLOR_OUTPUT)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
# TODO(cblichmann): Only apply this to SAPI and its dependencies
|
||||
add_compile_options(-fno-exceptions)
|
||||
|
||||
if(SAPI_HARDENED_SOURCE)
|
||||
add_compile_options(-fstack-protector -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2)
|
||||
endif()
|
||||
|
||||
# Make Bazel-style includes work
|
||||
configure_file(cmake/libcap_capability.h.in
|
||||
libcap/include/sys/capability.h
|
||||
|
|
|
@ -36,4 +36,6 @@ option(SAPI_DOWNLOAD_ZLIB "Download zlib at config time (only if SAPI_ENABLE_EXA
|
|||
option(SAPI_ENABLE_TESTS "Build unit tests" ON)
|
||||
option(SAPI_ENABLE_GENERATOR "Build Clang based code generator from source" OFF)
|
||||
|
||||
option(SAPI_HARDENED_SOURCE "Build with hardening compiler options" OFF)
|
||||
|
||||
option(SAPI_FORCE_COLOR_OUTPUT "Force colored compiler diagnostics when using Ninja" ON)
|
||||
|
|
Loading…
Reference in New Issue
Block a user