diff --git a/CMakeLists.txt b/CMakeLists.txt index fc6b610..88400ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,7 +67,7 @@ PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS add_library(tcpinfo_lib ${SRC_DIR}/tcpinfo_lib.cc ${SRC_DIR}/tcpinfo_lib.h ${SRC_DIR}/tcpinfo_c_adapter.h ${SRC_DIR}/tcpinfo_c_adapter.c - ${PROTO_HDRS} ${PROTO_SRCS}) + ${SRC_DIR}/gtest_prod.h ${PROTO_HDRS} ${PROTO_SRCS}) add_dependencies(tcpinfo_lib iproute2) target_link_libraries(tcpinfo_lib diff --git a/install-protobuf.sh b/install-protobuf.sh index 277c169..8f64a09 100755 --- a/install-protobuf.sh +++ b/install-protobuf.sh @@ -4,7 +4,8 @@ # check to see if protobuf tools already exist. LIBS=`/usr/bin/pkg-config --libs protobuf` -if [ $? -ne 0 ] ; then +PB_VER=`protoc --version` +if [[ ($? -ne 0) || ("${PB_VER}" < "libprotoc 3.1.0") || (-z "${LIBS}")]]; then if [ -r protobuf/configure ] ; then echo "Using cached protobuf." cd protobuf diff --git a/src/gtest_prod.h b/src/gtest_prod.h new file mode 100644 index 0000000..0dcaaa1 --- /dev/null +++ b/src/gtest_prod.h @@ -0,0 +1,9 @@ +// This is just a local copy of googletest gtest_prod.h, to avoid +// the dependency on the gtest library for production only sources. + +#ifndef GTEST_INCLUDE_GTEST_GTEST_PROD_H_ +#define GTEST_INCLUDE_GTEST_GTEST_PROD_H_ +#define FRIEND_TEST(test_case_name, test_name)\ +friend class test_case_name##_##test_name##_Test +#endif // GTEST_INCLUDE_GTEST_GTEST_PROD_H_ + diff --git a/src/tcpinfo_lib.h b/src/tcpinfo_lib.h index 4698215..8442f2e 100644 --- a/src/tcpinfo_lib.h +++ b/src/tcpinfo_lib.h @@ -24,7 +24,7 @@ #include "connection_cache.h" #include "tcpinfo.pb.h" -#include "gtest/gtest_prod.h" +#include "gtest_prod.h" // Using local copy instead of library include. extern "C" { #include // Should come from iproute2 submodule.