Skip to content

Commit

Permalink
Silence GCC discovery and bail when none available
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mosullivan93 committed Jun 29, 2023
1 parent 18d036f commit c0a99e0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# When unset, discover g++. Prioritise the latest version on the path.
ifeq (, $(and $(strip $(CXX)), $(filter-out default undefined, $(origin CXX))))
override CXX := $(shell basename `which g++-12 g++-11 g++-10 g++-9 g++-8 g++ | head -n 1`)
override CXX := $(shell which g++-12 g++-11 g++-10 g++-9 g++-8 g++ 2>/dev/null | head -n 1)
ifeq (, $(strip $(CXX)))
$(error Could not locate the g++ compiler. Please manually specify its path using the CXX variable)
endif
endif

export CXX
Expand Down

0 comments on commit c0a99e0

Please sign in to comment.