fix build with new protobuf target for pnnx #5034
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
nihui,您好!
1.我发现您没有修改相关的PNNX的Cmake,以支持最新的protobuf,我参考#4955对CMakeLists文件进行了修改。
2.我把find_package(protobuf)相关的代码从src/CMakeLists.txt下移动到pnnx目录下的CMakeLists.txt,这点主要是因为find_package(Torch REQUIRED)加载TorchConfig.cmake,这个cmake里定义了protobuf的相关目标,所以必须放在find_package(Torch REQUIRED)它前面,不然会有目标重复定义的错误。