From 0e71d2b49bfdb676d6939f589fb4e56ddf62791c Mon Sep 17 00:00:00 2001 From: Rodrigo Queiro Date: Wed, 31 May 2023 10:08:15 +0200 Subject: [PATCH 1/2] Warn about dragons in the Bazel `include` path https://github.com/google/glog/issues/837 has caused a couple of disappointments for PR authors, so I'm hoping this comment can save them some time, or even help them towards finding a complete solution for the problem. --- bazel/glog.bzl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bazel/glog.bzl b/bazel/glog.bzl index 3bb7485df..fdf3fc720 100644 --- a/bazel/glog.bzl +++ b/bazel/glog.bzl @@ -201,6 +201,12 @@ def glog_library(namespace = "google", with_gflags = 1, **kwargs): ":stl_logging_h", ":vlog_is_on_h", ], + # https://github.com/google/glog/issues/837: Replacing + # `strip_include_prefix` with `includes` would avoid spamming + # downstream projects with compiler warnings, but would also leak + # private headers like stacktrace.h. I suspect the only way to avoid + # this is to refactor the project including the CMake build, so that + # the private headers are in a glog_internal subdirectory. strip_include_prefix = "src", defines = final_lib_defines, copts = final_lib_copts, From 9d970f76bf24b498eeff14aa022ff5e7acd62e62 Mon Sep 17 00:00:00 2001 From: Rodrigo Queiro Date: Mon, 5 Jun 2023 11:04:35 +0200 Subject: [PATCH 2/2] Explain why strip_include_prefix works --- bazel/glog.bzl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bazel/glog.bzl b/bazel/glog.bzl index fdf3fc720..dacd93441 100644 --- a/bazel/glog.bzl +++ b/bazel/glog.bzl @@ -204,9 +204,11 @@ def glog_library(namespace = "google", with_gflags = 1, **kwargs): # https://github.com/google/glog/issues/837: Replacing # `strip_include_prefix` with `includes` would avoid spamming # downstream projects with compiler warnings, but would also leak - # private headers like stacktrace.h. I suspect the only way to avoid - # this is to refactor the project including the CMake build, so that - # the private headers are in a glog_internal subdirectory. + # private headers like stacktrace.h, because strip_include_prefix's + # implementation only creates symlinks for the public hdrs. I suspect + # the only way to avoid this is to refactor the project including the + # CMake build, so that the private headers are in a glog_internal + # subdirectory. strip_include_prefix = "src", defines = final_lib_defines, copts = final_lib_copts,