Make compiler/linker flags visible to dependencies.

PiperOrigin-RevId: 347396613
Change-Id: Ic80b6a731a3b182f3aa320d36b598d074e7f3802
This commit is contained in:
Anton D. Kachalov 2020-12-14 09:03:29 -08:00 committed by Copybara-Service
parent 319493f5f0
commit 218435d88e

View File

@ -34,6 +34,14 @@ set(SAPI_SOURCE_DIR "${PROJECT_SOURCE_DIR}" CACHE INTERNAL "" FORCE)
include(CheckCXXCompilerFlag)
# 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)
add_link_options(-Wl,-z,relro -Wl,-z,now)
endif()
# Sapi CMake modules, order matters
list(APPEND CMAKE_MODULE_PATH "${SAPI_SOURCE_DIR}/cmake")
include(SapiOptions)
@ -55,14 +63,6 @@ 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)
add_link_options(-Wl,-z,relro -Wl,-z,now)
endif()
# Make Bazel-style includes work
configure_file(cmake/libcap_capability.h.in
libcap/include/sys/capability.h