diff --git a/CMakeLists.txt b/CMakeLists.txt index 23bab93618..7cd79ca081 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,6 +25,14 @@ endif() project(dolphin-emu) +if (MSVC) + set(CMAKE_C_STANDARD 99) + set(CMAKE_CXX_STANDARD 20) + set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std:c++latest") + set(CMAKE_CXX_STANDARD_REQUIRED ON) + set(CMAKE_CXX_EXTENSIONS OFF) +endif() + # Name of the Dolphin distributor. If you redistribute Dolphin builds (forks, # unofficial builds) please consider identifying your distribution with a # unique name here. diff --git a/Externals/FreeSurround/CMakeLists.txt b/Externals/FreeSurround/CMakeLists.txt index 6d488f155e..9a17fff2fd 100644 --- a/Externals/FreeSurround/CMakeLists.txt +++ b/Externals/FreeSurround/CMakeLists.txt @@ -1,6 +1,8 @@ -set(CMAKE_CXX_STANDARD 14) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS OFF) +if (NOT MSVC) + set(CMAKE_CXX_STANDARD 14) + set(CMAKE_CXX_STANDARD_REQUIRED ON) + set(CMAKE_CXX_EXTENSIONS OFF) +endif() set(SRCS source/ChannelMaps.cpp diff --git a/Externals/WIL/tests/cpplatest/CMakeLists.txt b/Externals/WIL/tests/cpplatest/CMakeLists.txt index 22e45cc940..7255c97ef3 100644 --- a/Externals/WIL/tests/cpplatest/CMakeLists.txt +++ b/Externals/WIL/tests/cpplatest/CMakeLists.txt @@ -1,7 +1,9 @@ # Compilers often don't use the latest C++ standard as the default. Periodically update this value (possibly conditioned # on compiler) as new standards are ratified/support is available -set(CMAKE_CXX_STANDARD 17) +if (NOT MSVC) + set(CMAKE_CXX_STANDARD 17) +endif() project(witest.cpplatest) add_executable(witest.cpplatest) diff --git a/Externals/cubeb/CMakeLists.txt b/Externals/cubeb/CMakeLists.txt index 3604041d7d..65fda6c181 100644 --- a/Externals/cubeb/CMakeLists.txt +++ b/Externals/cubeb/CMakeLists.txt @@ -15,9 +15,12 @@ endif() if(POLICY CMP0063) cmake_policy(SET CMP0063 NEW) endif() -set(CMAKE_C_STANDARD 99) -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_STANDARD_REQUIRED ON) + +if (NOT MSVC) + set(CMAKE_C_STANDARD 99) + set(CMAKE_CXX_STANDARD 11) + set(CMAKE_CXX_STANDARD_REQUIRED ON) +endif() if(NOT COMMAND add_sanitizers) list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/sanitizers-cmake/cmake") diff --git a/Externals/discord-rpc/src/CMakeLists.txt b/Externals/discord-rpc/src/CMakeLists.txt index 8e20faac86..c49b26faf6 100644 --- a/Externals/discord-rpc/src/CMakeLists.txt +++ b/Externals/discord-rpc/src/CMakeLists.txt @@ -4,7 +4,9 @@ option(ENABLE_IO_THREAD "Start up a separate I/O thread, otherwise I'd need to c option(USE_STATIC_CRT "Use /MT[d] for dynamic library" OFF) option(WARNINGS_AS_ERRORS "When enabled, compiles with `-Werror` (on *nix platforms)." OFF) -set(CMAKE_CXX_STANDARD 14) +if (NOT MSVC) + set(CMAKE_CXX_STANDARD 14) +endif() set(BASE_RPC_SRC ${PROJECT_SOURCE_DIR}/include/discord_rpc.h diff --git a/Externals/imgui/CMakeLists.txt b/Externals/imgui/CMakeLists.txt index 2b805f7725..3b6be85f50 100644 --- a/Externals/imgui/CMakeLists.txt +++ b/Externals/imgui/CMakeLists.txt @@ -1,6 +1,8 @@ -set(CMAKE_CXX_STANDARD 17) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS OFF) +if (NOT MSVC) + set(CMAKE_CXX_STANDARD 17) + set(CMAKE_CXX_STANDARD_REQUIRED ON) + set(CMAKE_CXX_EXTENSIONS OFF) +endif() set(SRCS imgui.cpp diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 3017a2abd8..9815023369 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -18,15 +18,12 @@ if(CMAKE_SYSTEM_NAME MATCHES "Windows") add_definitions(-D_SILENCE_CXX20_OLD_SHARED_PTR_ATOMIC_SUPPORT_DEPRECATION_WARNING) endif() -if (MSVC) - set(CMAKE_CXX_STANDARD 20) - set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std:c++latest") -else() +if (NOT MSVC) set(CMAKE_CXX_STANDARD 17) + set(CMAKE_CXX_STANDARD_REQUIRED ON) + set(CMAKE_CXX_EXTENSIONS OFF) endif() -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) if (MSVC)