poac icon indicating copy to clipboard operation
poac copied to clipboard

Incorrect CXX value in internally generated Makefile

Open watiko opened this issue 9 months ago • 1 comments

In the Makefile generated by poac when the CXX environment variable is not specified, CXX is specified as follows.

CXX ?= clang++
# https://github.com/poac-dev/poac/blob/0.9.3/src/BuildConfig.cc#L569

In this case, CXX is Implicit Variables in Gnu Make, so the default value of g++ is retained. This means that unintentional use of g++ will occur via make when CXX environment variables are not specified. https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html

I'm not familiar with make, but the following might work as intended.

ifeq "$(origin CXX)" "default"
	CXX := clang++
endif

.PHONY: all
all:
	@echo "$(info $(CXX))"

watiko avatar May 13 '24 18:05 watiko