This is an automated email from the ASF dual-hosted git repository.

chenBright pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brpc.git


The following commit(s) were added to refs/heads/master by this push:
     new 25de8e91 fix(cmake): prefer generated proto headers over in-source 
leftovers (#3506)
25de8e91 is described below

commit 25de8e91d34309506871f1ef6417a49eaf167f4f
Author: darion-yaphet <[email protected]>
AuthorDate: Tue Sep 1 10:24:15 2026 +0800

    fix(cmake): prefer generated proto headers over in-source leftovers (#3506)
    
    Make-generated src/**/*.pb.h can shadow newer build-dir headers and
    break compiles after proto updates such as EPROGREADTIMEOUT.
---
 CMakeLists.txt | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 93113b6f..47c14586 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -66,7 +66,6 @@ set(BRPC_COMMON_COMPILE_OPTIONS)
 set(BRPC_COMMON_DEFINITIONS)
 set(BRPC_COMMON_INCLUDE_DIRS
     ${PROJECT_SOURCE_DIR}/src
-    ${CMAKE_CURRENT_BINARY_DIR}
 )
 set(BRPC_COMMON_LINK_OPTIONS)
 set(BRPC_CXX_STANDARD 14)
@@ -417,6 +416,10 @@ endif()
 list(REMOVE_DUPLICATES BRPC_COMMON_INCLUDE_DIRS)
 
 add_library(brpc_common_config INTERFACE)
+# Generated protobuf headers live in the build directory. Search it before src/
+# so leftover in-source *.pb.h (gitignored, produced by Make) cannot shadow
+# updated .proto files such as errno.proto.
+target_include_directories(brpc_common_config BEFORE INTERFACE 
${CMAKE_CURRENT_BINARY_DIR})
 target_include_directories(brpc_common_config INTERFACE 
${BRPC_COMMON_INCLUDE_DIRS})
 target_compile_definitions(brpc_common_config INTERFACE 
${BRPC_COMMON_DEFINITIONS})
 target_compile_options(brpc_common_config INTERFACE 
${BRPC_COMMON_COMPILE_OPTIONS})


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to