diff --git a/CMakeLists.txt b/CMakeLists.txt index 63375083..5b659762 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,12 +41,12 @@ endfunction() list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") -include(TestCXX11) -set(CMAKE_CXX_STANDARD 11) +include(TestCXX17) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED true) if(NOT CYGWIN) - # We don't want to use -std=gnu++11 instead of -std=c++11, but among other - # things, -std=c++11 on cygwin defines __STRICT_ANSI__ which makes cygwin + # We don't want to use -std=gnu++17 instead of -std=c++17, but among other + # things, -std=c++17 on cygwin defines __STRICT_ANSI__ which makes cygwin # not to compile: undefined references to strerror_r, to fdopen, to # strcasecmp, etc (their declarations in system headers are between ifdef) set(CMAKE_CXX_EXTENSIONS false) diff --git a/README.md b/README.md index 60336595..8a7345e9 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Core: * GNU make * pkg-config -* GCC 4.8 or clang 3.2 +* GCC 8 or clang 5 * CMake ## Optional Requirements diff --git a/cmake/TestCXX11.cmake b/cmake/TestCXX17.cmake similarity index 56% rename from cmake/TestCXX11.cmake rename to cmake/TestCXX17.cmake index a55652fb..61fc739e 100644 --- a/cmake/TestCXX11.cmake +++ b/cmake/TestCXX17.cmake @@ -14,26 +14,26 @@ # limitations under the License. # -if(NOT DEFINED cxx11check) - message(STATUS "Checking for C++11 support") - get_filename_component(_CXX11Check_dir "${CMAKE_CURRENT_LIST_FILE}" +if(NOT DEFINED cxx17check) + message(STATUS "Checking for C++17 support") + get_filename_component(_CXX17Check_dir "${CMAKE_CURRENT_LIST_FILE}" DIRECTORY) - try_compile(cxx11_supported - "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/cxx11check" - "${_CXX11Check_dir}/cxx11check" cxx11check - OUTPUT_VARIABLE _CXX11Check_tryout) - if(cxx11_supported) - message(STATUS "Checking for C++11 support - supported") - SET(cxx11check 1 CACHE INTERNAL "C++11 support") + try_compile(cxx17_supported + "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/cxx17check" + "${_CXX17Check_dir}/cxx17check" cxx17check + OUTPUT_VARIABLE _CXX17Check_tryout) + if(cxx17_supported) + message(STATUS "Checking for C++17 support - supported") + SET(cxx17check 1 CACHE INTERNAL "C++17 support") file(APPEND "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log" - "Output of C++11 check:\n${_CXX11Check_tryout}\n") + "Output of C++17 check:\n${_CXX17Check_tryout}\n") else() file(APPEND "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log" - "Error in C++11 check:\n${_CXX11Check_tryout}\n") - message(STATUS "Checking for C++11 support - not supported") + "Error in C++17 check:\n${_CXX17Check_tryout}\n") + message(STATUS "Checking for C++17 support - not supported") message(FATAL_ERROR " Upgrade your compiler.\n" - " GCC 4.8+ and Clang 3.2+ are known to work.") + " GCC 8+ and Clang 5+ should work.") endif() endif() diff --git a/cmake/cxx11check/CMakeLists.txt b/cmake/cxx17check/CMakeLists.txt similarity index 96% rename from cmake/cxx11check/CMakeLists.txt rename to cmake/cxx17check/CMakeLists.txt index c9da4946..ed9d69e5 100644 --- a/cmake/cxx11check/CMakeLists.txt +++ b/cmake/cxx17check/CMakeLists.txt @@ -18,6 +18,6 @@ cmake_minimum_required(VERSION 3.13) project(cxx11check LANGUAGES CXX) set(CMAKE_VERBOSE_MAKEFILE true) -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED true) add_executable(main main.cpp) diff --git a/cmake/cxx11check/main.cpp b/cmake/cxx17check/main.cpp similarity index 96% rename from cmake/cxx11check/main.cpp rename to cmake/cxx17check/main.cpp index 0436ab5b..3e704c31 100644 --- a/cmake/cxx11check/main.cpp +++ b/cmake/cxx17check/main.cpp @@ -11,6 +11,7 @@ // warranty. #include +#include template struct check { @@ -59,5 +60,6 @@ void test() { func(0); } int main() { std::map m; m.emplace(2, 4); + auto [x, y] = *m.begin(); return 0; } diff --git a/test/integration/CMakeLists.txt b/test/integration/CMakeLists.txt index 5b16001f..cc63a3aa 100644 --- a/test/integration/CMakeLists.txt +++ b/test/integration/CMakeLists.txt @@ -17,7 +17,7 @@ cmake_minimum_required(VERSION 3.13) project(ZNCIntegrationTest LANGUAGES CXX) -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED true) set(CMAKE_THREAD_PREFER_PTHREAD true)