Copilot commented on code in PR #3612:
URL: https://github.com/apache/brpc/pull/3612#discussion_r4305391674


##########
test/CMakeLists.txt:
##########
@@ -19,7 +19,11 @@ find_package(Gperftools)
 
 add_library(brpc_test_config INTERFACE)
 target_link_libraries(brpc_test_config INTERFACE brpc_common_config)
-target_include_directories(brpc_test_config INTERFACE 
${CMAKE_CURRENT_BINARY_DIR})
+target_include_directories(brpc_test_config BEFORE INTERFACE
+    ${CMAKE_CURRENT_BINARY_DIR}
+    ${PROJECT_SOURCE_DIR}/src
+    ${PROTOBUF_INCLUDE_DIRS}

Review Comment:
   Adding `${PROJECT_SOURCE_DIR}/src` directly to `brpc_test_config` puts it 
before the transitive include directories from `brpc_common_config`, including 
the generated `${PROJECT_BINARY_DIR}` directory. That reverses the 
generated-header protection for test compilations: if an in-source 
`src/brpc/*.pb.h` is left over, tests will select it before the freshly 
generated header. Keep only the test binary directory here and let 
`brpc_common_config` provide the generated/source/protobuf order, or explicitly 
place `${PROJECT_BINARY_DIR}` before this source directory.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to