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_BINARY_DIR}"
"${SAPI_SOURCE_DIR}" "${SAPI_SOURCE_DIR}"
"${Protobuf_INCLUDE_DIR}" "${Protobuf_INCLUDE_DIR}"
# Need to reach into Abseil internal headers from a few targets.
"${CMAKE_BINARY_DIR}/absl-src"
) )
if(UNIX) if(UNIX)
foreach(flag IN ITEMS -Wno-deprecated foreach(flag IN ITEMS -Wno-deprecated

View File

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

View File

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