Adding $(GTEST_CPPFLAGS) to both snappy_unittest_CPPFLAGS and
snappy_unittest_CXXFLAGS is redundant. See this part of Makefile.in:
snappy_unittest-snappy-test.o: snappy-test.cc
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(snappy_unittest_CPPFLAGS) $(CPPFLAGS) $(snappy_unittest_CXXFLAGS) $(CXXFLAGS) -MT snappy_unittest-snappy-test.o -MD -MP -MF $(DEPDIR)/snappy_unittest-snappy-test.Tpo -c -o snappy_unittest-snappy-test.o `test -f 'snappy-test.cc' || echo '$(srcdir)/'`snappy-test.cc
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/snappy_unittest-snappy-test.Tpo $(DEPDIR)/snappy_unittest-snappy-test.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='snappy-test.cc' object='snappy_unittest-snappy-test.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(snappy_unittest_CPPFLAGS) $(CPPFLAGS) $(snappy_unittest_CXXFLAGS) $(CXXFLAGS) -c -o snappy_unittest-snappy-test.o `test -f 'snappy-test.cc' || echo '$(srcdir)/'`snappy-test.ccest.cc
Note that the CPPFLAGS and the CXXFLAGS are both copied into the compiler
command line.
From reading gtest.m4 (which defines GTEST_LIB_CHECK), it appears that the
correct course of action is to set:
snappy_unittest_CPPFLAGS = $(GTEST_CPPFLAGS)
snappy_unittest_CXXFLAGS = $(gflags_CFLAGS) $(GTEST_CXXFLAGS)
because $(GTEST_CPPFLAGS) and $(GTEST_CXXFLAGS) are both defined.
Note also that because $(gflags_CFLAGS) comes from pkg-config, it could set
flags that make sense for the compiler but not the preprocessor, so I believe
that it belongs in the CXXFLAGS, too.
Original issue reported on code.google.com by endgame....@gmail.com on 22 Mar 2011 at 11:59
Original issue reported on code.google.com by
endgame....@gmail.com
on 22 Mar 2011 at 11:59