mdbx-test: using c++17 (for std::string_view).

Change-Id: I79d9bac8ea8ba6c337d71683549a37c8434b93fa
This commit is contained in:
Leonid Yuriev 2019-10-06 12:27:38 +03:00
parent f629914217
commit 85cd04b712
2 changed files with 5 additions and 23 deletions

View File

@ -19,11 +19,9 @@ mandir ?= $(prefix)/man
suffix ?=
CC ?= gcc
CXX ?= g++
LD ?= ld
MDBX_OPTIONS ?= -D_GNU_SOURCE=1 -DNDEBUG=1
CFLAGS ?= -O2 -g3 -Wall -Werror -Wextra -ffunction-sections -fPIC -fvisibility=hidden -std=gnu11 -pthread
CXXFLAGS = -std=c++11 $(filter-out -std=gnu11,$(CFLAGS))
# LY: '--no-as-needed,-lrt' for ability to built with modern glibc, but then run with the old
LDFLAGS ?= $(shell $(LD) --help 2>/dev/null | grep -q -- --gc-sections && echo '-Wl,--gc-sections,-z,relro,-O1')$(shell $(LD) --help 2>/dev/null | grep -q -- -dead_strip && echo '-Wl,-dead_strip')
@ -121,9 +119,12 @@ TEST_ITER := $(shell $(uname2titer))
TEST_SRC := test/osal-$(TEST_OSAL).cc $(filter-out $(wildcard test/osal-*.cc), $(wildcard test/*.cc))
TEST_INC := $(wildcard test/*.h)
TEST_OBJ := $(patsubst %.cc,%.o,$(TEST_SRC))
CXX ?= g++
CXXSTD ?= $(shell $(CXX) -std=c++27 -c test/test.cc -o /dev/null 2>/dev/null && echo -std=c++17 || echo -std=c++11)
CXXFLAGS := $(CXXSTD) $(filter-out -std=gnu11,$(CFLAGS))
MAN_SRCDIR := src/man1/
ALLOY_DEPS = $(wildcard src/elements/*)
ALLOY_DEPS := $(wildcard src/elements/*)
MDBX_VERSION_GIT = ${shell set -o pipefail; git describe --tags | sed -n 's|^v*\([0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\)\(.*\)|\1|p' || echo 'Please fetch tags and/or install latest git version'}
MDBX_GIT_TIMESTAMP = $(shell git show --no-patch --format=%cI HEAD || echo 'Please install latest get version')
MDBX_GIT_DESCRIBE = $(shell git describe --tags --long --dirty=-dirty || echo 'Please fetch tags and/or install latest git version')

View File

@ -1,22 +1,3 @@
list(FIND CMAKE_CXX_COMPILE_FEATURES cxx_std_17 HAS_CXX17)
list(FIND CMAKE_CXX_COMPILE_FEATURES cxx_std_14 HAS_CXX14)
list(FIND CMAKE_CXX_COMPILE_FEATURES cxx_relaxed_constexpr HAS_RELAXED_CONSTEXPR)
if(NOT DEFINED MDBX_CXX_STANDARD)
if(DEFINED CMAKE_CXX_STANDARD)
set(MDBX_CXX_STANDARD ${CMAKE_CXX_STANDARD})
elseif(NOT HAS_CXX17 LESS 0)
set(MDBX_CXX_STANDARD 17)
elseif(NOT HAS_CXX14 LESS 0)
set(MDBX_CXX_STANDARD 14)
else()
set(MDBX_CXX_STANDARD 11)
endif()
endif()
message(STATUS "Use C++${MDBX_CXX_STANDARD} for libmdbx's test")
if(NOT SUBPROJECT OR NOT DEFINED CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD ${MDBX_CXX_STANDARD})
endif()
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
set(TEST_OSAL windows)
else()
@ -52,7 +33,7 @@ add_executable(mdbx_test
set_target_properties(mdbx_test PROPERTIES
INTERPROCEDURAL_OPTIMIZATION $<BOOL:${INTERPROCEDURAL_OPTIMIZATION}>
CXX_STANDARD ${MDBX_CXX_STANDARD}
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
)