Skip to content

Commit 3a1aaf9

Browse files
committed
Find the protobuf version automatically
1 parent db7768b commit 3a1aaf9

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

tensorflow_cc/cmake/ProtobufExternal.cmake

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
1-
set(PROTOBUF_ARCHIVE https://github.com/protocolbuffers/protobuf/archive/v3.9.2.zip)
1+
# Find the proper protobuf archive url.
2+
file(DOWNLOAD
3+
"https://raw.githubusercontent.com/tensorflow/tensorflow/${TENSORFLOW_TAG}/tensorflow/workspace2.bzl"
4+
"${CMAKE_CURRENT_BINARY_DIR}/tmp/workspace2.bzl"
5+
)
6+
file(READ
7+
"${CMAKE_CURRENT_BINARY_DIR}/tmp/workspace2.bzl"
8+
workspace2_str
9+
)
10+
string(REGEX MATCH
11+
"https://github.com/protocolbuffers/protobuf/archive/v[.0-9]+.zip"
12+
PROTOBUF_ARCHIVE
13+
"${workspace2_str}"
14+
)
15+
message("Will build Protobuf from '${PROTOBUF_ARCHIVE}'.")
216

317
ExternalProject_Add(
418
protobuf-external

0 commit comments

Comments
 (0)