From e1aa301c395afe399898d84c13297c4c2557ed52 Mon Sep 17 00:00:00 2001 From: Fedja Beader Date: Sat, 9 Dec 2023 20:00:13 +0100 Subject: Correct issue with GTEST_DIR not being passed properly. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- Makefile.in | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Makefile.in b/Makefile.in index 610e7f6..10f909c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -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) -- cgit v1.2.3-60-g2f50