From 42f540bc7edfdd02037a939f05b7cdd237ac22c9 Mon Sep 17 00:00:00 2001 From: Christian Blichmann Date: Wed, 3 Feb 2021 09:00:41 -0800 Subject: [PATCH] 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 --- CMakeLists.txt | 2 -- sandboxed_api/CMakeLists.txt | 6 +++--- sandboxed_api/util/CMakeLists.txt | 12 +++++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fa35b0f..e8c505c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 diff --git a/sandboxed_api/CMakeLists.txt b/sandboxed_api/CMakeLists.txt index 8703ff6..a023d86 100644 --- a/sandboxed_api/CMakeLists.txt +++ b/sandboxed_api/CMakeLists.txt @@ -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 diff --git a/sandboxed_api/util/CMakeLists.txt b/sandboxed_api/util/CMakeLists.txt index 1ac4fb1..c7af144 100644 --- a/sandboxed_api/util/CMakeLists.txt +++ b/sandboxed_api/util/CMakeLists.txt @@ -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