Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 770a57f0 authored by Daniel Vrátil's avatar Daniel Vrátil 🤖

Enable C++17 with MSVC

Our target on Windows is MSVC 15, which has good support for C++17
so we can use <optional> and <variant> - on other platforms we stick
with C++14 and using experimental/optional etc.
parent b25c8089
......@@ -3,7 +3,16 @@ cmake_minimum_required(VERSION 3.5)
set(PIM_VERSION "5.10.44")
project(Akonadi VERSION ${PIM_VERSION})
set(CMAKE_CXX_STANDARD 14)
if (MSVC)
# On Windows our target compiler is MSVC 15, which supports C++17, so
# we can enable it. MSVC does not ship experimental/optional and similar
# and disallows use of C++17 classes in C++14 mode.
set(CMAKE_CXX_STANDARD 17)
else()
# On Linux, MacOS and BSD we need to support older compilers that only
# offer C++14.
set(CMAKE_CXX_STANDARD 14)
endif()
# ECM setup
......
......@@ -21,7 +21,7 @@
#define AKOPTIONAL_H
#ifdef __has_include
#if __has_include(<optional>) && !defined(_MSC_VER) // MSVC won't let us use <optional> in C++14 despite having it
#if __has_include(<optional>)
#include <optional>
#elif __has_include(<experimental/optional>)
#include <experimental/optional>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment