diff --git a/.travis.yml b/.travis.yml index ee37729..51430d9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,33 +28,26 @@ matrix: packages: - g++-6 env: COMPILER=gcc GCC=6 + - os: linux addons: apt: sources: - ubuntu-toolchain-r-test - - llvm-toolchain-precise-3.6 - packages: - - clang-3.6 - env: COMPILER=clang CLANG=3.6 - - os: linux - addons: - apt: - sources: - - ubuntu-toolchain-r-test - - llvm-toolchain-precise-3.7 + - llvm-toolchain-xenial-5.0 packages: - - clang-3.7 - env: COMPILER=clang CLANG=3.7 + - g++-4.9 + - clang-5.0 + env: COMPILER=clang CLANG=5.0 - os: linux addons: apt: sources: - ubuntu-toolchain-r-test - - llvm-toolchain-precise-3.9 + - llvm-toolchain-xenial-6.0 packages: - - clang-3.9 - env: COMPILER=clang CLANG=3.9 + - clang-6.0 + env: COMPILER=clang CLANG=6.0 - os: osx osx_image: xcode8 compiler: clang diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 1fa8ada..463a14b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -17,7 +17,7 @@ jobs: - job: macOS pool: - vmImage: 'xcode9-macos10.13' + vmImage: 'macOS-10.15' strategy: maxParallel: 2 variables: diff --git a/cookiecutter.json b/cookiecutter.json index d9f2dbd..7fe385d 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -9,7 +9,7 @@ "cpp_namespace": "{{ cookiecutter.package_name }}", "cpp_root_folder_name": "{{ cookiecutter.package_name }}", "cpp_macro_prefix": "{{ cookiecutter.project_name|upper|replace(' ', '_')|replace('-', '_') }}", - "cpp_standart": ["C++14", "C++11", "NotSpecified"], + "cpp_standart": ["C++20", "C++17", "C++14", "C++11", "NotSpecified"], "cmake_project_name": "{{ cookiecutter.package_name }}", "cmake_interface_library_name": "{{ cookiecutter.package_name }}", "github_project_name": "{{ cookiecutter.project_slug }}", diff --git a/{{cookiecutter.github_project_name}}/CMakeLists.txt b/{{cookiecutter.github_project_name}}/CMakeLists.txt index 417894a..ff7516d 100644 --- a/{{cookiecutter.github_project_name}}/CMakeLists.txt +++ b/{{cookiecutter.github_project_name}}/CMakeLists.txt @@ -8,7 +8,27 @@ set(PROJECT_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include) set(CPP_ROOT_FOLDER_NAME {{cookiecutter.cpp_root_folder_name}}) include_directories(${PROJECT_INCLUDE_DIR}) -{% if cookiecutter.cpp_standart == 'C++14' -%} +{% if cookiecutter.cpp_standart == 'C++20' -%} +include(CheckCXXCompilerFlag) +if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Intel") + CHECK_CXX_COMPILER_FLAG("-std=c++20" HAS_CPP20_FLAG) + if (HAS_CPP20_FLAG) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++20") + else() + message(FATAL_ERROR "Unsupported compiler -- C++20 support required!") + endif() +endif() +{% elif cookiecutter.cpp_standart == 'C++17' -%} +include(CheckCXXCompilerFlag) +if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Intel") + CHECK_CXX_COMPILER_FLAG("-std=c++17" HAS_CPP17_FLAG) + if (HAS_CPP17_FLAG) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17") + else() + message(FATAL_ERROR "Unsupported compiler -- C++17 support required!") + endif() +endif() +{% elif cookiecutter.cpp_standart == 'C++14' -%} # C++ 14 # =========== include(CheckCXXCompilerFlag)