The target protobuf::protoc exists since cmake 3.10.

Fixes for cmake version later than v3.10, e.g., cmake 3.9.

See also upstream patch:

    c281acf807

Signed-off-by: Tao He <sighingnow@gmail.com>
This commit is contained in:
Tao He 2021-08-04 11:27:56 +08:00
parent 891dc7bedf
commit a69638409c
1 changed files with 9 additions and 0 deletions

View File

@ -54,6 +54,15 @@ endif()
find_package(OpenSSL REQUIRED) find_package(OpenSSL REQUIRED)
find_package(Protobuf REQUIRED) find_package(Protobuf REQUIRED)
if(Protobuf_PROTOC_EXECUTABLE)
if(NOT TARGET protobuf::protoc)
add_executable(protobuf::protoc IMPORTED)
if(EXISTS "${Protobuf_PROTOC_EXECUTABLE}")
set_target_properties(protobuf::protoc PROPERTIES
IMPORTED_LOCATION "${Protobuf_PROTOC_EXECUTABLE}")
endif()
endif()
endif()
find_package(cpprestsdk QUIET) find_package(cpprestsdk QUIET)
if(cpprestsdk_FOUND) if(cpprestsdk_FOUND)
set(CPPREST_INCLUDE_DIR) set(CPPREST_INCLUDE_DIR)