jarvis657 / snappy

Automatically exported from code.google.com/p/snappy
Other
0 stars 0 forks source link

Makefile.am: redundant addition of $(GTEST_CPPFLAGS) #10

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago

Original comment by se...@google.com on 23 Mar 2011 at 1:11

GoogleCodeExporter commented 9 years ago
Fixed in r12.

Original comment by se...@google.com on 23 Mar 2011 at 11:17