diff --git a/tools/caffe/CMakeLists.txt b/tools/caffe/CMakeLists.txt index 733ec1a6268..1f825aa7b35 100644 --- a/tools/caffe/CMakeLists.txt +++ b/tools/caffe/CMakeLists.txt @@ -2,6 +2,10 @@ find_package(Protobuf) if(PROTOBUF_FOUND) + if(DEFINED Protobuf_VERSION AND Protobuf_VERSION VERSION_GREATER_EQUAL 3.22) + set(CMAKE_CXX_STANDARD 17) + endif() + protobuf_generate_cpp(CAFFE_PROTO_SRCS CAFFE_PROTO_HDRS caffe.proto) add_executable(caffe2ncnn caffe2ncnn.cpp ${CAFFE_PROTO_SRCS} ${CAFFE_PROTO_HDRS}) target_include_directories(caffe2ncnn diff --git a/tools/onnx/CMakeLists.txt b/tools/onnx/CMakeLists.txt index f78c3f8ee9f..dcbdd27ed56 100644 --- a/tools/onnx/CMakeLists.txt +++ b/tools/onnx/CMakeLists.txt @@ -2,6 +2,10 @@ find_package(Protobuf) if(PROTOBUF_FOUND) + if(DEFINED Protobuf_VERSION AND Protobuf_VERSION VERSION_GREATER_EQUAL 3.22) + set(CMAKE_CXX_STANDARD 17) + endif() + protobuf_generate_cpp(ONNX_PROTO_SRCS ONNX_PROTO_HDRS onnx.proto) add_executable(onnx2ncnn onnx2ncnn.cpp ${ONNX_PROTO_SRCS} ${ONNX_PROTO_HDRS}) target_include_directories(onnx2ncnn