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.
This commit is contained in:
Georg Baum 2016-07-02 12:42:04 +02:00
parent e49d59dafc
commit 987dd84461

View File

@ -39,6 +39,12 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "^[cC]lang$")
else() else()
if (CYGWIN) if (CYGWIN)
set(CXX11_FLAG_CANDIDATES "--std=gnu++11") set(CXX11_FLAG_CANDIDATES "--std=gnu++11")
else()
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() else()
set(CXX11_FLAG_CANDIDATES set(CXX11_FLAG_CANDIDATES
"--std=c++14" "--std=c++14"
@ -48,6 +54,7 @@ else()
) )
endif() endif()
endif() endif()
endif()
# sample openmp source code to test # sample openmp source code to test
SET(CXX11_TEST_SOURCE SET(CXX11_TEST_SOURCE