提交 5d0b9583 编写于 作者: W wangguibao

Fix protobuf.cmake for Cmake 3.9 and above

上级 4e6c1a5a
......@@ -123,7 +123,13 @@ macro(PROMPT_PROTOBUF_LIB)
SET(Protobuf_PROTOC_EXECUTABLE ${PROTOBUF_PROTOC_EXECUTABLE})
# For CMake 3.9 and above
add_executable(protobuf::protoc ALIAS protoc)
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()
FOREACH(dep ${protobuf_DEPS})
ADD_DEPENDENCIES(protobuf ${dep})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册