Skip to content

Commit 1dc9be1

Browse files
authored
Support non-standard location for protobuf. (#1757)
When the protobuf library is installed in a non-standard location (i.e. not in `/usr/*`) we need additional options for the protobuf compiler.
1 parent 90a640a commit 1dc9be1

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

google/cloud/bigtable/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,14 @@ google_cloud_cpp_add_common_options(bigtable_common_options)
5454
list(APPEND PROTOBUF_IMPORT_DIRS "${PROJECT_THIRD_PARTY_DIR}/googleapis"
5555
"${PROJECT_SOURCE_DIR}")
5656

57+
# Sometimes (this happens often with vcpkg) protobuf is installed in a non-
58+
# standard directory. We need to find out where, and then add that directory to
59+
# the search path for protos.
60+
find_path(PROTO_INCLUDE_DIR google/protobuf/descriptor.proto)
61+
if (PROTO_INCLUDE_DIR)
62+
list(INSERT PROTOBUF_IMPORT_DIRS 0 "${PROTO_INCLUDE_DIR}")
63+
endif ()
64+
5765
# Include the functions to compile proto files.
5866
include(CompileProtos)
5967
protobuf_generate_cpp(

0 commit comments

Comments
 (0)