From ae9219ab4f6e7f130fc091be5d9792a0aea09673 Mon Sep 17 00:00:00 2001 From: daquexian Date: Wed, 16 Oct 2019 10:58:44 +0800 Subject: [PATCH] Use variables instead of target in cmake < 3.9 --- tools/onnx2bnn/CMakeLists.txt | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tools/onnx2bnn/CMakeLists.txt b/tools/onnx2bnn/CMakeLists.txt index 297db07..d07a175 100644 --- a/tools/onnx2bnn/CMakeLists.txt +++ b/tools/onnx2bnn/CMakeLists.txt @@ -14,9 +14,21 @@ add_library(onnx2bnn target_link_libraries(onnx2bnn glog::glog onnx - protobuf::libprotobuf flatbuffers ) +if (CMAKE_VERSION VERSION_LESS "3.9.0") + target_link_libraries(onnx2bnn + # ${PROTOBUF_LIBRARIES} and ${PROTOBUF_INCLUDE_DIRS} is for cmake 3.5 + ${PROTOBUF_LIBRARIES} ${Protobuf_LIBRARIES}) + target_include_directories(onnx2bnn + PUBLIC + ${PROTOBUF_INCLUDE_DIRS} ${Protobuf_INCLUDE_DIRS}) +else() + target_link_libraries(onnx2bnn + protobuf::libprotobuf + ) +endif() + target_include_directories(onnx2bnn PUBLIC ${PROJECT_SOURCE_DIR}