From 334576cb4afc2ec76195a34849cc0c57d6afae5a Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 2 Oct 2017 06:49:46 +0200 Subject: slowly start enabling c++17 --- cmake/opentrack-platform.cmake | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'cmake') diff --git a/cmake/opentrack-platform.cmake b/cmake/opentrack-platform.cmake index 7e627e64..b977c5d8 100644 --- a/cmake/opentrack-platform.cmake +++ b/cmake/opentrack-platform.cmake @@ -62,13 +62,23 @@ if(MSVC) add_definitions(-DNOMINMAX -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS -D_NO_DEBUG_HEAP) add_definitions(-D_ITERATOR_DEBUG_LEVEL=0) add_definitions(-D_HAS_EXCEPTIONS=0) - if(MSVC_VERSION GREATER 1909) # visual studio 2017 - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -permissive- -diagnostics:caret") - set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -permissive- -diagnostics:caret") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Zi") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Zi") + + if(NOT CMAKE_COMPILER_IS_CLANG) + if(MSVC_VERSION GREATER 1909) # visual studio 2017 + set(__stuff "-permissive- -diagnostics:caret -Qvec-report:1") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${__stuff}") + set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} ${__stuff}") + endif() + + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std:c++latest") + else() + set(__stuff "-fms-compatibility -fms-compatibility-version=1911 -fms-extensions") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${__stuff} -std:c++latest -Xclang -std=c++17") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${__stuff}") endif() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Zi -std:c++14") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Zi") if(opentrack-64bit) set(ent "-HIGHENTROPYVA") else() @@ -116,8 +126,8 @@ if(APPLE) endif() if(NOT MSVC) - set(CMAKE_CXX_STANDARD 14) - set(CMAKE_CXX_STANDARD_DEFAULT 14) + set(CMAKE_CXX_STANDARD 17) + set(CMAKE_CXX_STANDARD_DEFAULT 17) set(CMAKE_CXX_STANDARD_REQUIRED TRUE) set(CMAKE_CXX_EXTENSIONS FALSE) endif() -- cgit v1.2.3