Skip to content

Commit 5116a1f

Browse files
authored
Merge pull request #21 from daquexian/fix_protobuf_cmake
Fix wrong protobuf cmake variable when cmake < 3.6.0
2 parents 2a2fa36 + d6f097c commit 5116a1f

File tree

4 files changed

+19
-3
lines changed

4 files changed

+19
-3
lines changed

tools/converter/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ endif()
3030

3131
# -----------find protobuf lib-----------
3232
find_package(Protobuf REQUIRED)
33+
if (${CMAKE_VERSION} VERSION_LESS "3.6.0")
34+
set(Protobuf_LIBRARIES ${PROTOBUF_LIBRARIES})
35+
set(Protobuf_INCLUDE_DIRS ${PROTOBUF_INCLUDE_DIRS})
36+
endif()
3337

3438
# -----------set path-----------
3539
set(SRC_PATH source)

tools/converter/source/caffe/CMakeLists.txt

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@ set(CMAKE_C_STANDARD 99)
66
set(CMAKE_CXX_STANDARD 11)
77

88
find_package(Protobuf REQUIRED)
9+
if (${CMAKE_VERSION} VERSION_LESS "3.6.0")
10+
set(Protobuf_LIBRARIES ${PROTOBUF_LIBRARIES})
11+
set(Protobuf_INCLUDE_DIRS ${PROTOBUF_INCLUDE_DIRS})
12+
endif()
913

10-
include_directories(${PROTOBUF_INCLUDE_DIR})
14+
include_directories(${Protobuf_INCLUDE_DIRS})
1115

1216
include_directories(${CMAKE_CURRENT_BINARY_DIR})
1317

tools/converter/source/onnx/CMakeLists.txt

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@ set(CMAKE_C_STANDARD 99)
66
set(CMAKE_CXX_STANDARD 11)
77

88
find_package(Protobuf REQUIRED)
9+
if (${CMAKE_VERSION} VERSION_LESS "3.6.0")
10+
set(Protobuf_LIBRARIES ${PROTOBUF_LIBRARIES})
11+
set(Protobuf_INCLUDE_DIRS ${PROTOBUF_INCLUDE_DIRS})
12+
endif()
913

10-
include_directories(${PROTOBUF_INCLUDE_DIR})
14+
include_directories(${Protobuf_INCLUDE_DIRS})
1115

1216
include_directories(${CMAKE_CURRENT_BINARY_DIR})
1317

tools/converter/source/tensorflow/CMakeLists.txt

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@ set(CMAKE_C_STANDARD 99)
66
set(CMAKE_CXX_STANDARD 11)
77

88
find_package(Protobuf REQUIRED)
9+
if (${CMAKE_VERSION} VERSION_LESS "3.6.0")
10+
set(Protobuf_LIBRARIES ${PROTOBUF_LIBRARIES})
11+
set(Protobuf_INCLUDE_DIRS ${PROTOBUF_INCLUDE_DIRS})
12+
endif()
913

10-
include_directories(${PROTOBUF_INCLUDE_DIR})
14+
include_directories(${Protobuf_INCLUDE_DIRS})
1115

1216
include_directories(${CMAKE_CURRENT_BINARY_DIR})
1317

0 commit comments

Comments
 (0)