diff --git a/CMakeLists.txt b/CMakeLists.txt index a96e9ce6..4becb45a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required (VERSION 2.8.12) -set (CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required +cmake_minimum_required (VERSION 3.8) +set (CMAKE_CXX_STANDARD 17) set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake") set (HAVE_CMAKE true) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9bd7e1bb..67d2f5a9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -206,5 +206,5 @@ To be a little more explicit, the common elements across the languages are: We target Python 3 so that our test suite runs on the broadest set of platforms. -We can safely target C++14 because all the default compilers on our supported platforms are ready. -Feel free to use C++17 and C++20 provided that all build platforms support this. +We can safely target C++17 because all the default compilers on our supported platforms are ready. +Feel free to use C++20 provided that all build platforms support this. diff --git a/ChangeLog b/ChangeLog index 8afc8993..4fe69a73 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,7 @@ - Use local man pages in tests (thanks to Maxim Beder) - Cleanup CMake files +- Update project to C++17 ------ current release --------------------------- diff --git a/INSTALL b/INSTALL index 023db5cd..89b09096 100644 --- a/INSTALL +++ b/INSTALL @@ -11,9 +11,9 @@ In order to build Timewarrior, you will need: - make - asciidoctor (for building documentation) -You will need a C++ compiler that supports full C++14, which includes: - - gcc 6.1 - - clang 3.4 +You will need a C++ compiler that supports full C++17, which includes: + - gcc 8 + - clang 5 # Basic Installation diff --git a/README.md b/README.md index f30f2609..f7190450 100644 --- a/README.md +++ b/README.md @@ -38,9 +38,9 @@ Thanks to the community, there are binary packages available [here](https://time Building Timewarrior yourself requires * git -* cmake +* cmake (>= 3.8) * make -* C++ compiler with full C++14 support, currently gcc 6.1+ or clang 3.4+ +* C++ compiler with full C++17 support, currently gcc 8+ or clang 5+ * Python 3 (for running the testsuite) * Asciidoctor (for creating documentation) diff --git a/cmake/CXXSniffer.cmake b/cmake/CXXSniffer.cmake index e7ad810a..97bd5673 100644 --- a/cmake/CXXSniffer.cmake +++ b/cmake/CXXSniffer.cmake @@ -1,30 +1,10 @@ -message ("-- Configuring C++11") message ("-- System: ${CMAKE_SYSTEM_NAME}") -include (CheckCXXCompilerFlag) - -# NOTE: Phase out -std=gnu++0x and --std=c++0x as soon as realistically possible. -CHECK_CXX_COMPILER_FLAG("-std=c++11" _HAS_CXX11) -CHECK_CXX_COMPILER_FLAG("-std=c++0x" _HAS_CXX0X) -CHECK_CXX_COMPILER_FLAG("-std=gnu++0x" _HAS_GNU0X) - -if (_HAS_CXX11) - set (_CXX11_FLAGS "-std=c++11") -elseif (_HAS_CXX0X) - message (WARNING "Enabling -std=c++0x draft compile flag. Your compiler does not support the standard '-std=c++11' option. Consider upgrading.") - set (_CXX11_FLAGS "-std=c++0x") -elseif (_HAS_GNU0X) - message (WARNING "Enabling -std=gnu++0x draft compile flag. Your compiler does not support the standard '-std=c++11' option. Consider upgrading.") - set (_CXX11_FLAGS "-std=gnu++0x") -else (_HAS_CXX11) - message (FATAL_ERROR "C++11 support missing. Try upgrading your C++ compiler. If you have a good reason for using an outdated compiler, please let us know at support@gothenburgbitfactory.org.") -endif (_HAS_CXX11) - if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") set (LINUX true) elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") set (DARWIN true) - set (_CXX11_FLAGS "${_CXX11_FLAGS} -stdlib=libc++") + set (CMAKE_CXX_FLAGS "-stdlib=libc++ ${CMAKE_CXX_FLAGS}") elseif (${CMAKE_SYSTEM_NAME} MATCHES "kFreeBSD") set (KFREEBSD true) elseif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") @@ -41,13 +21,8 @@ elseif (${CMAKE_SYSTEM_NAME} STREQUAL "GNU") set (GNUHURD true) elseif (${CMAKE_SYSTEM_NAME} STREQUAL "CYGWIN") set (CYGWIN true) - # NOTE: Not setting -std=gnu++0x leads to compile errors even with - # GCC 4.8.3, and debugging those leads to insanity. Adding this - # workaround instead of fixing Cygwin. - set (_CXX11_FLAGS "-std=gnu++0x") else (${CMAKE_SYSTEM_NAME} MATCHES "Linux") set (UNKNOWN true) endif (${CMAKE_SYSTEM_NAME} MATCHES "Linux") -set (CMAKE_CXX_FLAGS "${_CXX11_FLAGS} ${CMAKE_CXX_FLAGS}") set (CMAKE_CXX_FLAGS "-Wall -Wextra -Wsign-compare -Wreturn-type ${CMAKE_CXX_FLAGS}") diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index f19fde1d..3b7a53e5 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.8) message ("-- Configuring documentation") diff --git a/doc/holidays/CMakeLists.txt b/doc/holidays/CMakeLists.txt index 85f284ac..182fe606 100644 --- a/doc/holidays/CMakeLists.txt +++ b/doc/holidays/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.8) message ("-- Configuring holiday documentation") diff --git a/doc/man1/CMakeLists.txt b/doc/man1/CMakeLists.txt index 044a6c74..8d710d3d 100644 --- a/doc/man1/CMakeLists.txt +++ b/doc/man1/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.8) file (GLOB DOC_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.1.adoc") set (DOC_FILES) diff --git a/doc/man7/CMakeLists.txt b/doc/man7/CMakeLists.txt index b6064c49..74b482e3 100644 --- a/doc/man7/CMakeLists.txt +++ b/doc/man7/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.8) file (GLOB DOC_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.7.adoc") set (DOC_FILES) diff --git a/doc/themes/CMakeLists.txt b/doc/themes/CMakeLists.txt index 79465548..cb94d223 100644 --- a/doc/themes/CMakeLists.txt +++ b/doc/themes/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.8) message ("-- Configuring theme documentation") diff --git a/ext/CMakeLists.txt b/ext/CMakeLists.txt index 3faa00b4..43c57e60 100644 --- a/ext/CMakeLists.txt +++ b/ext/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.8) message ("-- Configuring extensions") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index cdaedc4a..54737c58 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.8) include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/src/commands diff --git a/src/commands/CMakeLists.txt b/src/commands/CMakeLists.txt index 6b6cb823..2e592c14 100644 --- a/src/commands/CMakeLists.txt +++ b/src/commands/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.8) include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/src/commands diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index f3d3e2bc..043a8797 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.8) # This is a work-around for the following CMake issue: # https://gitlab.kitware.com/cmake/cmake/issues/16062