Am Mon, 4 May 2020 12:53:42 +0200
schrieb Thibaut Cuvelier <[email protected]>:

> You can use the equivalent parameter /std:
> https://docs.microsoft.com/en-us/cpp/build/reference/std-specify-language-standard-version?view=vs-2019
> 
> Example: cl /std:c++14. If the standard is not supported, you get the warning 
> D9002.
> 
> Thibaut Cuvelier
> 

The attached patch is against master tree.
Could you please test if it works with old and with new msvc compiler?

(I cannot test, lacking windows OS)
        Kornel
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2a123e7c34..d0fc65f490 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -655,11 +655,16 @@ if(LYX_SHARED_LIBRARIES)
 	set(library_type SHARED)
 else()
 	set(library_type STATIC)
 endif()
 
-if(NOT MSVC)
+if(MSVC)
+  if (CXX11_FLAG MATCHES "\\+\\+(20)")
+    set(CMAKE_CXX_STANDARD ${CMAKE_MATCH_1})
+    message(STATUS "CMAKE_CXX_STANDARD set to ${CMAKE_CXX_STANDARD}")
+  endif()
+else()
 	if(NOT LYX_QUIET)
 		set(CMAKE_VERBOSE_MAKEFILE ON)
 	endif()
 	set(LYX_CXX_FLAGS "-Wall -Wunused-parameter ${LYX_GCC11_MODE}")
 	if(LYX_CXX_FLAGS MATCHES "\\+\\+(14|11|98)")
diff --git a/development/cmake/modules/FindCXX11Compiler.cmake b/development/cmake/modules/FindCXX11Compiler.cmake
index 739d267bf0..6871e1e80e 100644
--- a/development/cmake/modules/FindCXX11Compiler.cmake
+++ b/development/cmake/modules/FindCXX11Compiler.cmake
@@ -42,11 +42,13 @@ else()
   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 "noflagneeded")
+      set(CXX11_FLAG_CANDIDATES
+	"/std:c++20"
+	"noflagneeded")
     else()
       set(CXX11_FLAG_CANDIDATES
         "--std=c++14"
         "--std=c++11"
         "--std=gnu++11"

Attachment: pgpxHqz5KnI2S.pgp
Description: Digitale Signatur von OpenPGP

-- 
lyx-devel mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to