From 987dd8446131ab638217be9f7d29e17f87bf3e39 Mon Sep 17 00:00:00 2001 From: Georg Baum Date: Sat, 2 Jul 2016 12:42:04 +0200 Subject: [PATCH] Do not use --std=c++14 for MSVC MSVC does not need a special flag to specify the standard. Using --std=c++14 produces a warning, but compilation succeeds, so the old code did mistakenly choose --std=c++14 for MSVC. --- .../cmake/modules/FindCXX11Compiler.cmake | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/development/cmake/modules/FindCXX11Compiler.cmake b/development/cmake/modules/FindCXX11Compiler.cmake index 56fa0c34fe..c7045d1fd2 100644 --- a/development/cmake/modules/FindCXX11Compiler.cmake +++ b/development/cmake/modules/FindCXX11Compiler.cmake @@ -40,12 +40,19 @@ else() if (CYGWIN) set(CXX11_FLAG_CANDIDATES "--std=gnu++11") else() - set(CXX11_FLAG_CANDIDATES - "--std=c++14" - "--std=c++11" - "--std=gnu++11" - "--std=gnu++0x" - ) + if (MSVC) + # MSVC does not have a general C++11 flag, one can only switch off + # MS extensions with /Za in general or by extension with /Zc. + # Use an empty flag to ensure that CXX11_STD_REGEX is correctly set. + set(CXX11_FLAG_CANDIDATES "") + else() + set(CXX11_FLAG_CANDIDATES + "--std=c++14" + "--std=c++11" + "--std=gnu++11" + "--std=gnu++0x" + ) + endif() endif() endif()