Skip to content

Commit 8385fac

Browse files
committed
fixup clang version detection
1 parent eda86d5 commit 8385fac

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Makefile-variables

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,14 @@ CPPFLAGS := -MMD -MP
2727

2828
COMPILER_VERSION := $(shell $(CXX) --version | grep version | grep -o -m 1 "[0-9]\+\.[0-9]\+\.*[0-9]*" | head -n 1)
2929
COMPILER_VERSION_NUMBER := $(shell echo $(COMPILER_VERSION) | sed -e 's/\.\([0-9][0-9]\)/\1/g' -e 's/\.\([0-9]\)/0\1/g' -e 's/^[0-9]\{3,4\}$$/&00/')
30+
CLANG_16_OR_MORE := $(shell expr $(COMPILER_VERSION_NUMBER) \>= 160000)
3031
CLANG_13_OR_MORE := $(shell expr $(COMPILER_VERSION_NUMBER) \>= 130106)
31-
ifneq ($(CLANG_13_OR_MORE),0)
32+
ifneq ($(CLANG_16_OR_MORE),0)
3233
# supported: c++11, c++14, c++17, c++20, c++23
33-
# future: c++2c
34+
# future: c++2c/c++26
3435
CXXFLAGS ?= --std=c++23 -O3 -Iinclude $(shell pkg-config --cflags getargv)
36+
else ifneq ($(CLANG_13_OR_MORE),0)
37+
CXXFLAGS ?= --std=c++20 -O3 -Iinclude $(shell pkg-config --cflags getargv)
3538
else
3639
CXXFLAGS ?= --std=c++17 -O3 -Iinclude $(shell pkg-config --cflags getargv)
3740
endif

0 commit comments

Comments
 (0)