mirror of
https://github.com/google/sandboxed-api.git
synced 2024-03-22 13:11:30 +08:00
CMake: Properly inherit sapi_base
propterties
- `SKIP_BUILD_RPATH` needs to be set per directory (not allow-listed for `INTERFACE` properties) - Use correct name for position independent code - `-pie`/`-fPIE` will only propagate fully on 3.14+ PiperOrigin-RevId: 428986266 Change-Id: Idf9d7fc184fbeec8ec1b77505246e262d9b8d880
This commit is contained in:
parent
aefdb94575
commit
cef861a0f2
|
@ -44,7 +44,7 @@ endif()
|
|||
|
||||
include(CheckCXXCompilerFlag)
|
||||
|
||||
# Sapi CMake modules, order matters
|
||||
# SAPI CMake modules, order matters
|
||||
list(APPEND CMAKE_MODULE_PATH "${SAPI_SOURCE_DIR}/cmake"
|
||||
"${SAPI_SOURCE_DIR}/cmake/modules")
|
||||
include(SapiOptions)
|
||||
|
@ -56,6 +56,13 @@ include(GNUInstallDirs)
|
|||
# Allow the header generator to auto-configure include paths
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
set(CMAKE_SKIP_BUILD_RPATH ON)
|
||||
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.14)
|
||||
include(CheckPIESupported)
|
||||
check_pie_supported()
|
||||
endif()
|
||||
|
||||
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)
|
||||
|
@ -76,7 +83,7 @@ configure_file(cmake/libcap_capability.h.in
|
|||
|
||||
# Library with basic project settings. The empty file is there to be able to
|
||||
# define header-only libraries without cumbersome target_sources() hacks.
|
||||
file(WRITE ${SAPI_BINARY_DIR}/sapi_base_force_cxx_linkage.cc "")
|
||||
file(WRITE "${SAPI_BINARY_DIR}/sapi_base_force_cxx_linkage.cc" "")
|
||||
add_library(sapi_base STATIC
|
||||
"${SAPI_BINARY_DIR}/sapi_base_force_cxx_linkage.cc"
|
||||
)
|
||||
|
@ -85,8 +92,7 @@ target_compile_features(sapi_base PUBLIC
|
|||
cxx_std_${SAPI_CXX_STANDARD}
|
||||
)
|
||||
set_target_properties(sapi_base PROPERTIES
|
||||
SKIP_BUILD_RPATH ON
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
INTERFACE_POSITION_INDEPENDENT_CODE ON
|
||||
)
|
||||
target_include_directories(sapi_base PUBLIC
|
||||
"${SAPI_BINARY_DIR}"
|
||||
|
|
Loading…
Reference in New Issue
Block a user