diff --git a/.github/actions/cmake/action.yml b/.github/actions/cmake/action.yml index a946f535..3bb00ea1 100644 --- a/.github/actions/cmake/action.yml +++ b/.github/actions/cmake/action.yml @@ -10,6 +10,7 @@ runs: run: | cmake -LA .. \ -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ - -DPROTOZERO_DATA_VIEW=$PROTOZERO_DATA_VIEW + -DPROTOZERO_DATA_VIEW=${PROTOZERO_DATA_VIEW} \ + -DCMAKE_CXX_STANDARD=${CPP_VERSION} shell: bash working-directory: build diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3d33584e..b02b4caa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,20 +22,26 @@ jobs: - "fedora:35" # gcc 11.2.1, clang 13.0.0, cmake 3.22.0 build_type: [Debug] cpp_compiler: [g++] - cpp_version: [c++11] + cpp_version: [11] include: - image: "debian:bullseye" - cpp_version: c++17 + cpp_version: 14 - image: "debian:bullseye" - cpp_version: c++20 + cpp_version: 17 + - image: "debian:bullseye" + cpp_version: 20 + - image: "debian:bullseye" + c_compiler: clang + cpp_compiler: clang++ + cpp_version: 14 - image: "debian:bullseye" c_compiler: clang cpp_compiler: clang++ - cpp_version: c++17 + cpp_version: 17 - image: "debian:bullseye" c_compiler: clang cpp_compiler: clang++ - cpp_version: c++20 + cpp_version: 20 - image: "debian:bullseye" build_type: Release - image: "debian:bullseye" diff --git a/CMakeLists.txt b/CMakeLists.txt index 25112e76..03891ace 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,6 +16,15 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) #----------------------------------------------------------------------------- +if (NOT "${CMAKE_CXX_STANDARD}") + set(CMAKE_CXX_STANDARD 11) +endif() +message(STATUS "Building in C++${CMAKE_CXX_STANDARD} mode") +set(CMAKE_CXX_EXTENSIONS OFF) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +#----------------------------------------------------------------------------- + option(BUILD_TESTING "Build tests" ON) option(WERROR "Add -Werror flag to build (turns warnings into errors)" ON) @@ -23,7 +32,7 @@ if(MSVC) add_compile_options(/W3) add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS) else() - add_compile_options(-std=c++11 -Wall -Wextra -pedantic -Wsign-compare -Wunused-parameter -Wno-float-equal -Wno-covered-switch-default) + add_compile_options(-Wall -Wextra -pedantic -Wsign-compare -Wunused-parameter -Wno-float-equal -Wno-covered-switch-default) if(WERROR) add_compile_options(-Werror) endif()