Skip to content

Commit

Permalink
clang < 13 has broken c++20
Browse files Browse the repository at this point in the history
  • Loading branch information
CamJN committed Nov 29, 2023
1 parent 562a006 commit 194f9b0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,18 @@ LIB_DIR = lib
PREFIX := /usr/local
CXX=clang++
CPPFLAGS += -MMD -MP
CXXFLAGS := --std=c++20 -O3 -Iinclude

COMPILER_VERSION := $(shell $(CXX) --version | grep version | grep -o -m 1 "[0-9]\+\.[0-9]\+\.*[0-9]*" | head -n 1)
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/')
CLANG_13_OR_MORE := $(shell expr $(COMPILER_VERSION_NUMBER) \>= 130000)
ifneq ($(CLANG_13_OR_MORE),0)
# supported: c++11, c++14, c++17, c++20
# future: c++2b
CXXFLAGS := --std=c++20 -O3 -Iinclude
else
CXXFLAGS := --std=c++17 -O3 -Iinclude
endif

EXTRA_CXXFLAGS := -pedantic-errors -Weverything -Wno-c++98-compat -Wno-pre-c++20-compat-pedantic -Wno-poison-system-directories
LDFLAGS += -Llib -fvisibility=default -fPIC
LDLIBS += -lgetargv
Expand Down

0 comments on commit 194f9b0

Please sign in to comment.