Commit 49966f6c authored by Clément Péron's avatar Clément Péron

cmake: keep compatibility with CMake FindProtobuf module

PROTOBUF_PROTOC_EXECUTABLE is not set in the Protobuf CMake config file.
Set it properly in case we use CMake protobuf config file.
Signed-off-by: default avatarClément Péron <peron.clem@gmail.com>
parent 1c954558
......@@ -20,7 +20,10 @@ if (MSVC AND NOT BUILD_SHARED_LIBS)
endif (MSVC AND NOT BUILD_SHARED_LIBS)
FIND_PACKAGE(Protobuf CONFIG)
if(NOT Protobuf_FOUND)
if(Protobuf_FOUND)
# Keep compatibility with FindProtobuf CMake module
set(PROTOBUF_PROTOC_EXECUTABLE $<TARGET_FILE:protobuf::protoc>)
else()
MESSAGE(STATUS "Protobuf CMake config not found fallback to Cmake Module")
FIND_PACKAGE(Protobuf REQUIRED)
endif()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment