cmake: Use C++latest everywhere on MSVC.

This commit is contained in:
Admiral H. Curtiss 2022-05-21 03:31:41 +02:00
parent dbee810a04
commit 89fadd26a6
No known key found for this signature in database
GPG Key ID: F051B4C4044F33FB
7 changed files with 33 additions and 17 deletions

View File

@ -25,6 +25,14 @@ endif()
project(dolphin-emu) 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, # Name of the Dolphin distributor. If you redistribute Dolphin builds (forks,
# unofficial builds) please consider identifying your distribution with a # unofficial builds) please consider identifying your distribution with a
# unique name here. # unique name here.

View File

@ -1,6 +1,8 @@
set(CMAKE_CXX_STANDARD 14) if (NOT MSVC)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()
set(SRCS set(SRCS
source/ChannelMaps.cpp source/ChannelMaps.cpp

View File

@ -1,7 +1,9 @@
# Compilers often don't use the latest C++ standard as the default. Periodically update this value (possibly conditioned # 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 # 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) project(witest.cpplatest)
add_executable(witest.cpplatest) add_executable(witest.cpplatest)

View File

@ -15,9 +15,12 @@ endif()
if(POLICY CMP0063) if(POLICY CMP0063)
cmake_policy(SET CMP0063 NEW) cmake_policy(SET CMP0063 NEW)
endif() endif()
set(CMAKE_C_STANDARD 99)
set(CMAKE_CXX_STANDARD 11) if (NOT MSVC)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_C_STANDARD 99)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()
if(NOT COMMAND add_sanitizers) if(NOT COMMAND add_sanitizers)
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/sanitizers-cmake/cmake") list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/sanitizers-cmake/cmake")

View File

@ -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(USE_STATIC_CRT "Use /MT[d] for dynamic library" OFF)
option(WARNINGS_AS_ERRORS "When enabled, compiles with `-Werror` (on *nix platforms)." 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 set(BASE_RPC_SRC
${PROJECT_SOURCE_DIR}/include/discord_rpc.h ${PROJECT_SOURCE_DIR}/include/discord_rpc.h

View File

@ -1,6 +1,8 @@
set(CMAKE_CXX_STANDARD 17) if (NOT MSVC)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()
set(SRCS set(SRCS
imgui.cpp imgui.cpp

View File

@ -18,15 +18,12 @@ if(CMAKE_SYSTEM_NAME MATCHES "Windows")
add_definitions(-D_SILENCE_CXX20_OLD_SHARED_PTR_ATOMIC_SUPPORT_DEPRECATION_WARNING) add_definitions(-D_SILENCE_CXX20_OLD_SHARED_PTR_ATOMIC_SUPPORT_DEPRECATION_WARNING)
endif() endif()
if (MSVC) if (NOT MSVC)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std:c++latest")
else()
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
endif() endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
if (MSVC) if (MSVC)