Skip to content

Commit

Permalink
Build: C++14 support added
Browse files Browse the repository at this point in the history
  • Loading branch information
pbeckingham committed May 14, 2018
1 parent 2623d10 commit 53088da
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 38 deletions.
3 changes: 1 addition & 2 deletions CMakeLists.txt
@@ -1,5 +1,4 @@
cmake_minimum_required (VERSION 2.8) cmake_minimum_required (VERSION 3.0)
set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake") set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")


include (CheckFunctionExists) include (CheckFunctionExists)
Expand Down
3 changes: 2 additions & 1 deletion DEVELOPER.md
@@ -1,7 +1,8 @@
# How to Build Taskwarrior # How to Build Taskwarrior


## Satisfy the Requirements: ## 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) * libuuid (if not on macOS)
* gnutls (optional) * gnutls (optional)
* python 2.7 or 3 (optional, for running the test suite) * python 2.7 or 3 (optional, for running the test suite)
Expand Down
4 changes: 2 additions & 2 deletions INSTALL
Expand Up @@ -8,14 +8,14 @@ source.
Dependencies 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 from source. More information on CMake can be obtained at https://cmake.org


You will also need: You will also need:
- make - make


You will need a C++ compiler that supports full C++11, which includes: 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) - clang 3.4 (released 2014-01-02)


You will need the following libraries: You will need the following libraries:
Expand Down
8 changes: 4 additions & 4 deletions README.md
Expand Up @@ -40,13 +40,13 @@ There are many binary packages available, but to install from source requires:
* git * git
* cmake * cmake
* make * 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: Download the tarball, and expand it:


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


Or clone this repository: Or clone this repository:


Expand Down
31 changes: 9 additions & 22 deletions cmake/CXXSniffer.cmake
@@ -1,30 +1,21 @@
message ("-- Configuring C++11") message ("-- Configuring C++14")
message ("-- System: ${CMAKE_SYSTEM_NAME}") message ("-- System: ${CMAKE_SYSTEM_NAME}")


include (CheckCXXCompilerFlag) include (CheckCXXCompilerFlag)


# NOTE: Phase out -std=gnu++0x and --std=c++0x as soon as realistically possible. CHECK_CXX_COMPILER_FLAG("-std=c++14" _HAS_CXX14)
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) if (_HAS_CXX14)
set (_CXX11_FLAGS "-std=c++11") set (_CXX14_FLAGS "-std=c++14")
elseif (_HAS_CXX0X) else (_HAS_CXX14)
message (WARNING "Enabling -std=c++0x draft compile flag. Your compiler does not support the standard '-std=c++11' option. Consider upgrading.") 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.")
set (_CXX11_FLAGS "-std=c++0x") endif (_HAS_CXX14)
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") if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set (LINUX true) set (LINUX true)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set (DARWIN true) set (DARWIN true)
set (_CXX11_FLAGS "${_CXX11_FLAGS} -stdlib=libc++") set (_CXX14_FLAGS "${_CXX14_FLAGS} -stdlib=libc++")
elseif (${CMAKE_SYSTEM_NAME} MATCHES "kFreeBSD") elseif (${CMAKE_SYSTEM_NAME} MATCHES "kFreeBSD")
set (KFREEBSD true) set (KFREEBSD true)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") elseif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
Expand All @@ -41,13 +32,9 @@ elseif (${CMAKE_SYSTEM_NAME} STREQUAL "GNU")
set (GNUHURD true) set (GNUHURD true)
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "CYGWIN") elseif (${CMAKE_SYSTEM_NAME} STREQUAL "CYGWIN")
set (CYGWIN true) 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") else (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set (UNKNOWN true) set (UNKNOWN true)
endif (${CMAKE_SYSTEM_NAME} MATCHES "Linux") 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}") set (CMAKE_CXX_FLAGS "-Wall -Wextra -Wsign-compare -Wreturn-type ${CMAKE_CXX_FLAGS}")
2 changes: 1 addition & 1 deletion doc/CMakeLists.txt
@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 2.8) cmake_minimum_required (VERSION 3.0)
message ("-- Configuring man pages") message ("-- Configuring man pages")
set (man_FILES task-color.5 task-sync.5 taskrc.5 task.1) set (man_FILES task-color.5 task-sync.5 taskrc.5 task.1)
foreach (man_FILE ${man_FILES}) foreach (man_FILE ${man_FILES})
Expand Down
2 changes: 1 addition & 1 deletion performance/CMakeLists.txt
@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 2.8) cmake_minimum_required (VERSION 3.0)


add_custom_target (performance ./run_perf add_custom_target (performance ./run_perf
DEPENDS task_executable DEPENDS task_executable
Expand Down
2 changes: 1 addition & 1 deletion scripts/CMakeLists.txt
@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 2.8) cmake_minimum_required (VERSION 3.0)
install (DIRECTORY bash fish vim zsh hooks install (DIRECTORY bash fish vim zsh hooks
DESTINATION ${TASK_DOCDIR}/scripts) DESTINATION ${TASK_DOCDIR}/scripts)
install (DIRECTORY add-ons install (DIRECTORY add-ons
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 2.8) cmake_minimum_required (VERSION 3.0)
include_directories (${CMAKE_SOURCE_DIR} include_directories (${CMAKE_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/src
${CMAKE_SOURCE_DIR}/src/commands ${CMAKE_SOURCE_DIR}/src/commands
Expand Down
2 changes: 1 addition & 1 deletion src/columns/CMakeLists.txt
@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 2.8) cmake_minimum_required (VERSION 3.0)
include_directories (${CMAKE_SOURCE_DIR} include_directories (${CMAKE_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/src
${CMAKE_SOURCE_DIR}/src/commands ${CMAKE_SOURCE_DIR}/src/commands
Expand Down
2 changes: 1 addition & 1 deletion src/commands/CMakeLists.txt
@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 2.8) cmake_minimum_required (VERSION 3.0)
include_directories (${CMAKE_SOURCE_DIR} include_directories (${CMAKE_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/src
${CMAKE_SOURCE_DIR}/src/commands ${CMAKE_SOURCE_DIR}/src/commands
Expand Down
2 changes: 1 addition & 1 deletion test/CMakeLists.txt
@@ -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. # See this CMake issue before complaining about the following.
# https://cmake.org/Bug/view.php?id=16062 # https://cmake.org/Bug/view.php?id=16062
Expand Down

0 comments on commit 53088da

Please sign in to comment.