Enable C++17

All supported platforms now have easy access to a compiler with C++17
support.

C++17 potentially allows for some nice cleanups and removes the need
for standard library backports (optional/variant).

See discussion at https://dolp.in/pr6264#discussion_r158134178
This commit is contained in:
Léo Lam
2017-12-25 22:35:08 +01:00
parent 99a4ca8de7
commit 04c8201c32
4 changed files with 4 additions and 3484 deletions

View File

@ -16,18 +16,13 @@ if(CMAKE_C_COMPILER_ID MATCHES "MSVC")
check_and_add_flag(CPPLATEST /std:c++latest)
check_and_add_flag(STANDARD_COMPLIANCE /permissive-)
else()
# Enable C++17, but fall back to C++14 if it isn't available.
# CMAKE_CXX_STANDARD cannot be used here because we require C++14 or newer, not any standard.
# Enable C++17
# CMAKE_CXX_STANDARD cannot be used because it requires cmake 3.8+.
check_and_add_flag(CXX17 -std=c++17)
if(NOT FLAG_CXX_CXX17)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# Fall back to -std=c++1z
check_and_add_flag(CXX1Z -std=c++1z)
endif()
# These compat headers must not be in the include path when building with MSVC,
# because it currently does not support __has_include_next / #include_next.
include_directories(SYSTEM Core/Common/Compat)
endif()
# These aren't actually needed for C11/C++11