Be more strict about target_link_libraries()

Bazel readily enforces header visiblity for each target, CMake is more lenient.

PiperOrigin-RevId: 355407845
Change-Id: Ic59fa2162db8456d4c5cf4205c0fe42cc79874a9
This commit is contained in:
Christian Blichmann 2021-02-03 09:00:41 -08:00 committed by Copybara-Service
parent 637dc471ac
commit 42f540bc7e
3 changed files with 10 additions and 10 deletions

View File

@ -89,8 +89,6 @@ target_include_directories(sapi_base INTERFACE
"${SAPI_BINARY_DIR}"
"${SAPI_SOURCE_DIR}"
"${Protobuf_INCLUDE_DIR}"
# Need to reach into Abseil internal headers from a few targets.
"${CMAKE_BINARY_DIR}/absl-src"
)
if(UNIX)
foreach(flag IN ITEMS -Wno-deprecated

View File

@ -25,9 +25,9 @@ add_library(sapi_config ${SAPI_LIB_TYPE}
config.h
)
add_library(sapi::config ALIAS sapi_config)
target_link_libraries(sapi_config PRIVATE
absl::config
sapi::base
target_link_libraries(sapi_config
PRIVATE sapi::base
INTERFACE absl::config
)
# sandboxed_api:proto_arg

View File

@ -65,11 +65,13 @@ add_library(sapi_util_raw_logging ${SAPI_LIB_TYPE}
raw_logging.h
)
add_library(sapi::raw_logging ALIAS sapi_util_raw_logging)
target_link_libraries(sapi_util_raw_logging PRIVATE
absl::str_format
absl::strings
sapi::strerror
sapi::base
target_link_libraries(sapi_util_raw_logging
PRIVATE absl::config
absl::str_format
absl::strings
sapi::strerror
sapi::base
INTERFACE absl::core_headers
)
# sandboxed_api/util:runfiles