Skip to content

Commit bb745c1

Browse files
zhztheplayerfacebook-github-bot
authored andcommitted
build(cmake): Fix protobuf error during build when using Velox as a subproject (#12128)
Summary: Error message: ``` .../cmake-build-debug/_deps/velox-src/velox/dwio/dwrf/common/wrap/dwrf-proto-wrapper.cpp:37:10: fatal error: velox/dwio/dwrf/proto/dwrf_proto.pb.cc: No such file or directory 37 | #include "velox/dwio/dwrf/proto/dwrf_proto.pb.cc" | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated ``` This is because the generated `protoc` command relies on the root CMake project path so the command will be messed up when Velox is used as a module of nother CMake project. The patch fixes the issue. Pull Request resolved: #12128 Reviewed By: sdruzkin Differential Revision: D68448949 Pulled By: kagamiori fbshipit-source-id: b45269fcc5f4dd4f3f3343720367d3c9a20757f5
1 parent b7d30ba commit bb745c1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

velox/dwio/dwrf/proto/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ set(PROTO_OUTPUT_FILES ${PROTO_HDRS} ${PROTO_SRCS})
3131
set_source_files_properties(${PROTO_OUTPUT_FILES} PROPERTIES GENERATED TRUE)
3232

3333
# Ensure that the option --proto_path is not given an empty argument
34-
foreach(PROTO_PATH ${CMAKE_SOURCE_DIR} ${Protobuf_INCLUDE_DIRS})
34+
foreach(PROTO_PATH ${PROJECT_SOURCE_DIR} ${Protobuf_INCLUDE_DIRS})
3535
list(APPEND PROTO_PATH_ARGS --proto_path=${PROTO_PATH})
3636
endforeach()
3737

3838
add_custom_command(
3939
OUTPUT ${PROTO_OUTPUT_FILES}
40-
COMMAND protobuf::protoc ${PROTO_PATH_ARGS} --cpp_out ${CMAKE_BINARY_DIR}
40+
COMMAND protobuf::protoc ${PROTO_PATH_ARGS} --cpp_out ${PROJECT_BINARY_DIR}
4141
${PROTO_FILES_FULL}
4242
DEPENDS protobuf::protoc
4343
COMMENT "Running PROTO compiler"

0 commit comments

Comments
 (0)