Skip to content

Commit c0a99e0

Browse files
committed
Silence GCC discovery and bail when none available
On some systems, `which` will print to stderr when an argument can't be found. This will now be suppressed. Also removed `basename` to more gracefully handle the situation where `g++` is not on the path.
1 parent 18d036f commit c0a99e0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# When unset, discover g++. Prioritise the latest version on the path.
22
ifeq (, $(and $(strip $(CXX)), $(filter-out default undefined, $(origin CXX))))
3-
override CXX := $(shell basename `which g++-12 g++-11 g++-10 g++-9 g++-8 g++ | head -n 1`)
3+
override CXX := $(shell which g++-12 g++-11 g++-10 g++-9 g++-8 g++ 2>/dev/null | head -n 1)
4+
ifeq (, $(strip $(CXX)))
5+
$(error Could not locate the g++ compiler. Please manually specify its path using the CXX variable)
6+
endif
47
endif
58

69
export CXX

0 commit comments

Comments
 (0)