build: require c++11 for gtest, and link test exe against pthreads (linux build fails without it)

This commit is contained in:
Liam Staskawicz 2015-08-04 10:24:57 -07:00
parent 94de39fd6b
commit 28e13e55d7

View file

@ -4,7 +4,16 @@ GTEST := gtest-1.7.0
LDFLAGS=-O2 -Wall -Werror -fPIC LDFLAGS=-O2 -Wall -Werror -fPIC
CFLAGS=-O2 -Wall -Werror -fPIC -I. -Wno-unused-function CFLAGS=-O2 -Wall -Werror -fPIC -I. -Wno-unused-function
GTEST_CFLAGS=-I$(GTEST)/include ifneq (,$(findstring gcc, $(CC)))
# gcc's maybe-unintialized is too imprecise, disable it.
# clang disbles this functionality by default and doesn't recognize the flag.
# (check for CC that contains rather than equals 'gcc',
# to accommodate using specific versions, like gcc-4.9 etc)
CFLAGS += -Wno-maybe-uninitialized
endif
GTEST_CFLAGS=-I$(GTEST)/include -std=c++11
GTEST_LDFLAGS=-lpthread
all: capn.so capnpc-c test all: capn.so capnpc-c test
@ -30,4 +39,4 @@ gtest-all.o: $(GTEST)/src/*.cc
$(CXX) -g -Wall -Werror -I. $(GTEST_CFLAGS) -I$(GTEST) -o $@ -c $< $(CXX) -g -Wall -Werror -I. $(GTEST_CFLAGS) -I$(GTEST) -o $@ -c $<
capn-test: capn-test.o capn-stream-test.o compiler/test.capnp.o compiler/schema-test.o compiler/schema.capnp.o gtest-all.o capn-test: capn-test.o capn-stream-test.o compiler/test.capnp.o compiler/schema-test.o compiler/schema.capnp.o gtest-all.o
$(CXX) -g -Wall -Werror -I. -o $@ $^ $(CXX) -g -Wall -Werror -I. $^ $(GTEST_LDFLAGS) -o $@