fix linking with recent Google's C++ test framework
authorLaszlo Boszormenyi (GCS) <gcs@debian.org>
Tue, 24 Mar 2020 18:20:00 +0000 (18:20 +0000)
committerLaszlo Boszormenyi (GCS) <gcs@debian.org>
Tue, 24 Mar 2020 18:20:00 +0000 (18:20 +0000)
Last-Update: 2018-10-11

Need to link with libgtest_main.a as well.

Gbp-Pq: Name fix_google_test_link.patch

src/Makefile.am

index f5b93df0eb86e131eaec41e00ebf2550532880c7..b5aea6b52a2a4ebb8879dd7d9d89895ad525902b 100644 (file)
@@ -716,7 +716,7 @@ check_PROGRAMS = protoc protobuf-test protobuf-lazy-descriptor-test \
                  protobuf-lite-test test_plugin protobuf-lite-arena-test \
                  no-warning-test $(GZCHECKPROGRAMS)
 protobuf_test_LDADD = $(PTHREAD_LIBS) libprotobuf.la libprotoc.la -lgtest \
-                      -lgmock -lgmock_main
+                      -lgtest_main -lgmock -lgmock_main
 protobuf_test_CPPFLAGS = -I$(GOOGLETEST_SRC_DIR)/include \
                          -I$(GOOGLEMOCK_SRC_DIR)/include
 # Disable optimization for tests unless the user explicitly asked for it,
@@ -809,7 +809,7 @@ $(am_protobuf_test_OBJECTS): unittest_proto_middleman
 
 # Run cpp_unittest again with PROTOBUF_TEST_NO_DESCRIPTORS defined.
 protobuf_lazy_descriptor_test_LDADD = $(PTHREAD_LIBS) libprotobuf.la \
-                      libprotoc.la -lgtest -lgmock -lgmock_main
+                      libprotoc.la -lgtest -lgtest_main -lgmock -lgmock_main
 protobuf_lazy_descriptor_test_CPPFLAGS = -I$(GOOGLEMOCK_SRC_DIR)/include \
                                          -I$(GOOGLETEST_SRC_DIR)/include \
                                          -DPROTOBUF_TEST_NO_DESCRIPTORS
@@ -833,7 +833,7 @@ COMMON_LITE_TEST_SOURCES =                                             \
 # full runtime and we want to make sure this test builds without full
 # runtime.
 protobuf_lite_test_LDADD = $(PTHREAD_LIBS) libprotobuf-lite.la     \
-                           -lgtest -lgmock -lgmock_main
+                           -lgtest -lgtest_main -lgmock -lgmock_main
 protobuf_lite_test_CPPFLAGS= -I$(GOOGLEMOCK_SRC_DIR)/include \
                              -I$(GOOGLETEST_SRC_DIR)/include
 protobuf_lite_test_CXXFLAGS = $(NO_OPT_CXXFLAGS)
@@ -847,7 +847,7 @@ $(am_protobuf_lite_test_OBJECTS): unittest_proto_middleman
 # gtest when building the test internally our memory sanitizer doesn't detect
 # memory leaks (don't know why).
 protobuf_lite_arena_test_LDADD = $(PTHREAD_LIBS) libprotobuf-lite.la \
-                                 -lgtest -lgmock -lgmock_main
+                                 -lgtest -lgtest_main -lgmock -lgmock_main
 protobuf_lite_arena_test_CPPFLAGS = -I$(GOOGLEMOCK_SRC_DIR)/include  \
                                     -I$(GOOGLETEST_SRC_DIR)/include
 protobuf_lite_arena_test_CXXFLAGS = $(NO_OPT_CXXFLAGS)
@@ -859,7 +859,7 @@ $(am_protobuf_lite_arena_test_OBJECTS): unittest_proto_middleman
 
 # Test plugin binary.
 test_plugin_LDADD = $(PTHREAD_LIBS) libprotobuf.la libprotoc.la \
-                    -lgtest
+                    -lgtest -lgtest_main
 test_plugin_CPPFLAGS = -I$(GOOGLETEST_SRC_DIR)/include
 test_plugin_SOURCES =                                          \
   google/protobuf/compiler/mock_code_generator.cc              \