Permalink
Browse files

Build: C++14 support added

  • Loading branch information...
pbeckingham committed Feb 17, 2018
1 parent 2623d10 commit 53088dae659e14ab01bba4436272f07cc8937d08
@@ -1,5 +1,4 @@
cmake_minimum_required (VERSION 2.8)
set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required
cmake_minimum_required (VERSION 3.0)
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")

include (CheckFunctionExists)
@@ -1,7 +1,8 @@
# How to Build Taskwarrior

## Satisfy the Requirements:
* gcc 4.9 or later, clang 3.4 or later, or a compiler with full C++11 support.
* CMake 3.0 or later
* gcc 5.0 or later, clang 3.4 or later, or a compiler with full C++11 support
* libuuid (if not on macOS)
* gnutls (optional)
* python 2.7 or 3 (optional, for running the test suite)
@@ -8,14 +8,14 @@ source.
Dependencies
------------

You will need the CMake build system installed in order to build Taskwarrior
You will need the CMake 3.0+ build system installed in order to build Taskwarrior
from source. More information on CMake can be obtained at https://cmake.org

You will also need:
- make

You will need a C++ compiler that supports full C++11, which includes:
- gcc 4.9 (released 2014-04-22)
- gcc 5.0 (released 2013-12-23)
- clang 3.4 (released 2014-01-02)

You will need the following libraries:
@@ -40,13 +40,13 @@ There are many binary packages available, but to install from source requires:
* git
* cmake
* make
* C++ compiler, currently gcc 4.7+ or clang 3.3+ for full C++11 support
* C++ compiler, currently gcc 5.0+ or clang 3.4+ for full C++11 support

Download the tarball, and expand it:

$ curl -O https://taskwarrior.org/download/task-2.5.1.tar.gz
$ tar xzf task-2.5.1.tar.gz
$ cd task-2.5.1
$ curl -O https://taskwarrior.org/download/task-2.6.0.tar.gz
$ tar xzf task-2.6.0.tar.gz
$ cd task-2.6.0

Or clone this repository:

@@ -1,30 +1,21 @@
message ("-- Configuring C++11")
message ("-- Configuring C++14")
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)
CHECK_CXX_COMPILER_FLAG("-std=c++14" _HAS_CXX14)

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 (_HAS_CXX14)
set (_CXX14_FLAGS "-std=c++14")
else (_HAS_CXX14)
message (FATAL_ERROR "C++14 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_CXX14)

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 (_CXX14_FLAGS "${_CXX14_FLAGS} -stdlib=libc++")
elseif (${CMAKE_SYSTEM_NAME} MATCHES "kFreeBSD")
set (KFREEBSD true)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
@@ -41,13 +32,9 @@ 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 "${_CXX14_FLAGS} ${CMAKE_CXX_FLAGS}")
set (CMAKE_CXX_FLAGS "-Wall -Wextra -Wsign-compare -Wreturn-type ${CMAKE_CXX_FLAGS}")
@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 2.8)
cmake_minimum_required (VERSION 3.0)
message ("-- Configuring man pages")
set (man_FILES task-color.5 task-sync.5 taskrc.5 task.1)
foreach (man_FILE ${man_FILES})
@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 2.8)
cmake_minimum_required (VERSION 3.0)

add_custom_target (performance ./run_perf
DEPENDS task_executable
@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 2.8)
cmake_minimum_required (VERSION 3.0)
install (DIRECTORY bash fish vim zsh hooks
DESTINATION ${TASK_DOCDIR}/scripts)
install (DIRECTORY add-ons
@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 2.8)
cmake_minimum_required (VERSION 3.0)
include_directories (${CMAKE_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/src
${CMAKE_SOURCE_DIR}/src/commands
@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 2.8)
cmake_minimum_required (VERSION 3.0)
include_directories (${CMAKE_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/src
${CMAKE_SOURCE_DIR}/src/commands
@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 2.8)
cmake_minimum_required (VERSION 3.0)
include_directories (${CMAKE_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/src
${CMAKE_SOURCE_DIR}/src/commands
@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 2.8)
cmake_minimum_required (VERSION 3.0)

# See this CMake issue before complaining about the following.
# https://cmake.org/Bug/view.php?id=16062

0 comments on commit 53088da

Please sign in to comment.