recognize compiler version without gexpr

This commit is contained in:
orignal 2024-09-05 07:43:24 -04:00
parent 306ea2df37
commit 9a77c0a4b1

View File

@ -11,10 +11,10 @@ LDLIBS = -lcrypto -lssl -lz -lpthread -lboost_system -lboost_program_options
## (e.g. -fstack-protector-strong -Wformat -Werror=format-security), we do not want to remove ## (e.g. -fstack-protector-strong -Wformat -Werror=format-security), we do not want to remove
## -std=c++11. If you want to remove this variable please do so in a way that allows setting ## -std=c++11. If you want to remove this variable please do so in a way that allows setting
## custom FLAGS to work at build-time. ## custom FLAGS to work at build-time.
CXXVER := $(shell $(CXX) -dumpversion) CXXVER := $(shell $(CXX) -dumpversion|cut -c 1-2)
ifeq (${CXXVER}, "4.2.1") # older clang always returned 4.2.1 ifeq (${CXXVER}, "4.") # older clang always returned 4.2.1
$(error Compiler too old) $(error Compiler too old)
else ifeq ($(shell gexpr match ${CXXVER} "1[6-9]"),2) # clang 16 - 19 else ifeq (${CXXVER}, ${filter ${CXXVER},16 17 18 19}) # clang 16 - 19
NEEDED_CXXFLAGS = -std=c++20 NEEDED_CXXFLAGS = -std=c++20
else else
NEEDED_CXXFLAGS = -std=c++17 NEEDED_CXXFLAGS = -std=c++17