From c5756e24a836d5a50aa973cafdda6a63291e8ab3 Mon Sep 17 00:00:00 2001 From: Dawid Drozd Date: Sun, 29 Dec 2019 15:00:20 +0100 Subject: [PATCH] Update needed c++ version --- CMakeLists.txt | 4 +++- lib/CMakeLists.txt | 17 ++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5d86095..2f3c9ae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,12 +3,14 @@ cmake_minimum_required(VERSION 3.11 FATAL_ERROR) # Layout of project is inspired by: https://youtu.be/6sWec7b0JIc?t=20m50s # This top level CMakeLists should be used for development -project(EventBusDev) +project(EventBusDev LANGUAGES CXX) option(ENABLE_TEST "Enable test" ON) option(ENABLE_PERFORMANCE "Enable performance subproject" OFF) set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) add_subdirectory(lib/) add_subdirectory(use_case/) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 6a6b580..7d38123 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -9,13 +9,6 @@ project(EventBus LANGUAGES CXX ) -# Why C++ 17 needed: -# - std::shared_mutex used -# - nested namespaces e.g. my::name::space - -set(CMAKE_CXX_STANDARD 17) -set(CMAKE_CXX_STANDARD_REQUIRED ON) - # Dependencies # No dependencies for EventBus yay! @@ -62,6 +55,16 @@ add_library(EventBus ) add_library(Dexode::EventBus ALIAS EventBus) +# Why C++ 17 needed: +# - std::shared_mutex used +# - nested namespaces e.g. my::name::space + +set_target_properties(EventBus PROPERTIES + CXX_STANDARD 17 + CXX_STANDARD_REQUIRED YES + CXX_EXTENSIONS NO # -std=c++17 rather than -std=gnu++17 + ) + target_compile_features(EventBus PUBLIC cxx_std_17) target_include_directories(EventBus PUBLIC