Update project to C++17

- Bump CMake to minimum version 3.8
- Set C++ standard to 17
- Remove CMAKE_LEGACY_CYGWIN_WIN32 compatibility mode
- Remove C++11 stuff
- Update documentation

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
This commit is contained in:
Thomas Lauf 2023-05-06 19:59:10 +02:00
parent 6c287870dd
commit 3008e458e9
15 changed files with 20 additions and 44 deletions

View file

@ -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)

View file

@ -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.

View file

@ -11,6 +11,7 @@
- Use local man pages in tests
(thanks to Maxim Beder)
- Cleanup CMake files
- Update project to C++17
------ current release ---------------------------

View file

@ -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

View file

@ -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)

View file

@ -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}")

View file

@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 2.8.12)
cmake_minimum_required (VERSION 3.8)
message ("-- Configuring documentation")

View file

@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 2.8.12)
cmake_minimum_required (VERSION 3.8)
message ("-- Configuring holiday documentation")

View file

@ -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)

View file

@ -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)

View file

@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 2.8.12)
cmake_minimum_required (VERSION 3.8)
message ("-- Configuring theme documentation")

View file

@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 2.8.12)
cmake_minimum_required (VERSION 3.8)
message ("-- Configuring extensions")

View file

@ -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

View file

@ -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

View file

@ -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