Skip to content

Commit 58e60ae

Browse files
committed
Cause CMake to fail if the protobuf compiler is not found
1 parent d0b88b6 commit 58e60ae

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
* Added support in the C++ API for deserializing set AuxData into unordered_sets.
1111
* Fixed issue causing compile errors when building with Boost 1.86+.
1212
* Building the C++ API now requires Boost 1.68 or later.
13+
* Fixed an obscure build error caused by a missing protobuf compiler. CMake now
14+
explicitly checks for the protobuf compiler before generating build files.
1315

1416
# 2.2.0
1517

CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,16 @@ if(CL_API)
427427
else()
428428
find_package(Protobuf 3.0.0 REQUIRED)
429429
endif()
430+
if(NOT Protobuf_PROTOC_EXECUTABLE)
431+
# find_package only fails if the protobuf libraries or headers cannot be
432+
# found. It does not treat failing to find the protobuf compiler as an error,
433+
# so we do that explicitly here.
434+
message(
435+
FATAL_ERROR
436+
"Could not find Protobuf compiler 'protoc'. Please make sure the "
437+
"Protobuf compiler is installed."
438+
)
439+
endif()
430440

431441
if(Protobuf_VERSION VERSION_LESS 3.2)
432442
add_definitions(-DPROTOBUF_SET_BYTES_LIMIT)

0 commit comments

Comments
 (0)