diff --git a/CMakeLists.txt b/CMakeLists.txt index 48f8f17..7c59781 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,16 +48,14 @@ endif() if (DEFINED ENV{CXXFLAGS_STD}) set(CXXFLAGS_STD $ENV{CXXFLAGS_STD}) else() - set(CXXFLAGS_STD "c++11") + set(CXXFLAGS_STD "c++14") endif() -if (${CXXFLAGS_STD} STREQUAL "c++17") - set(CMAKE_CXX_STANDARD 17) -elseif (${CXXFLAGS_STD} STREQUAL "c++14") - set(CMAKE_CXX_STANDARD 14) -else() - set(CMAKE_CXX_STANDARD 11) +# Transform "c++17" into "17". "-1" means "rest of the string". +if (NOT DEFINED WDAS_CXX_STANDARD) + string(SUBSTRING "${CXXFLAGS_STD}" 3 -1 WDAS_CXX_STANDARD) endif() +set(CMAKE_CXX_STANDARD "${WDAS_CXX_STANDARD}") set(CMAKE_CXX_STANDARD_REQUIRED ON) set(THREADS_PREFER_PTHREAD_FLAG OFF) set(CMAKE_CXX_EXTENSIONS OFF)