Skip to content

Commit

Permalink
Correct issue with GTEST_DIR not being passed properly.
Browse files Browse the repository at this point in the history
Note how gcc uses /usr/include/gtest (default search path) as the -I for GTEST_DIR is not on the gcc command line:
System-wide gtest is 1.14 and requires C++14 while provided one is 1.8.1.

GTEST_DIR="$PWD/deps/googletest/googletest" ./configure --user

make[1]: Leaving directory '/data/users/tmwa/proj/tmw/classic/tmwa'
find: ‘doc-gen/’: No such file or directory
g++ -std=c++0x  -I . -I ./include -DGENERATING_DEPENDENCIES -O2 -g
-fstack-protector -fno-strict-aliasing -fvisibility=hidden
-fvisibility=hidden -MG -MM \
    -MT 'ast/item_test := ' \
    -MF obj/ast/item_test.d src/ast/item_test.cpp
In file included from /usr/include/gtest/gtest-message.h:57,
                 from /usr/include/gtest/gtest-assertion-result.h:46,
                 from /usr/include/gtest/gtest.h:64,
                 from src/ast/item_test.cpp:21:
/usr/include/gtest/internal/gtest-port.h:270:2: error: #error C++
versions less than C++14 are not supported.
  270 | #error C++ versions less than C++14 are not supported.
      |  ^~~~~
Makefile:331: obj/ast/item_test.d: No such file or directory
  • Loading branch information
specing authored and bjorn committed Mar 8, 2024
1 parent 790c57e commit e1aa301
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -492,8 +492,15 @@ lib/%.a:

${GTEST_BINARIES}: obj/gtest_main.pdc.o obj/gtest-all.pdc.o

# This isn't perfect.
$(filter %_test.pdc.o,${PDC_OBJECTS}) obj/gtest_main.pdc.o obj/gtest-all.pdc.o: override CPPFLAGS += -DGTEST_HAS_PTHREAD=0 -I${GTEST_DIR}
# Need gtest include for both compile (*_test.pdc.o) and dependency-generation (*_test.d) steps.
GTEST_NEED_INCLUDE := $(filter %_test.pdc.o,${PDC_OBJECTS}) $(filter %_test.d,${DEPENDS}) obj/gtest_main.pdc.o obj/gtest-all.pdc.o
${GTEST_NEED_INCLUDE}: override CXXFLAGS += -DGTEST_HAS_PTHREAD=0 -I${GTEST_DIR}/include


# Special rule for src/gtest-all.cc, it includes "src/gtest.cc"
# and thus additionally needs toplevel as include
obj/gtest-all.pdc.o: override CXXFLAGS += -DGTEST_HAS_PTHREAD=0 -I${GTEST_DIR}

obj/gtest-all.pdc.o obj/gtest_main.pdc.o: override WARNINGS :=
obj/gtest%.pdc.o: ${GTEST_DIR}/src/gtest%.cc
$(MKDIR_FIRST)
Expand Down

0 comments on commit e1aa301

Please sign in to comment.