Am Tue, 5 May 2020 12:36:03 +0200 schrieb Yu Jin <[email protected]>:
> Am Di., 5. Mai 2020 um 09:16 Uhr schrieb Kornel Benko <[email protected]>: > > > Am Tue, 5 May 2020 09:15:50 +0200 > > schrieb Kornel Benko <[email protected]>: > > > Thanks Eugene. Please try the next patch. > > > If it also does not work, we have to decide on the msvc version > > > what to do. > > > > > > Could you also check the msvc-version (somewhere in the CMakeLists.txt) > > > > > > message(STATUS "MSVC_VERSION = ${MSVC_VERSION}") > > > > > > Kornel > > > > Forgot to attach. > > > Still same errors, unary_function was removed in the newer c++ standards, > and the patch sets language standard to latest (Vorschau – Features aus dem > aktuellen C++-Arbeitsentwurf (/std:c++latest)) for me, where it's just > "standard" whithout it. I attached the message line at the end of > CMakeLists, it says "MSVC_VERSION = 1925". > > Eugene Sorry, next try. Kornel
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2a123e7c34..618f62ac32 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 "\\+\\+([0-9]+)")
+ 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..e1bf1fbdc5 100644
--- a/development/cmake/modules/FindCXX11Compiler.cmake
+++ b/development/cmake/modules/FindCXX11Compiler.cmake
@@ -42,11 +42,19 @@ 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")
+ if (MSVC_VERSION LESS 1926)
+ set(CXX11_FLAG_CANDIDATES "noflagneeded")
+ else()
+ set(CXX11_FLAG_CANDIDATES
+ "/std:c++20"
+ "/std:c++17"
+ "/std:c++14"
+ "noflagneeded")
+ endif()
else()
set(CXX11_FLAG_CANDIDATES
"--std=c++14"
"--std=c++11"
"--std=gnu++11"
@@ -111,11 +119,13 @@ int main()
# check c compiler
set(SAFE_CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET})
set(CMAKE_REQUIRED_QUIET ON)
SET(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
FOREACH(FLAG ${CXX11_FLAG_CANDIDATES})
- IF(NOT "${FLAG}" STREQUAL "noflagneeded")
+ IF("${FLAG}" STREQUAL "noflagneeded")
+ UNSET(CMAKE_REQUIRED_FLAGS)
+ ELSE()
SET(CMAKE_REQUIRED_FLAGS "${FLAG}")
ENDIF()
UNSET(CXX11_FLAG_DETECTED CACHE)
CHECK_CXX_SOURCE_COMPILES("${CXX11_TEST_SOURCE}" CXX11_FLAG_DETECTED)
IF(CXX11_FLAG_DETECTED)
pgpooHfLIjNH1.pgp
Description: Digitale Signatur von OpenPGP
-- lyx-devel mailing list [email protected] http://lists.lyx.org/mailman/listinfo/lyx-devel
