cmake: Require cmake 3.15 for MSVC

We need these policies, but we kind of want to avoid requiring cmake
3.15 for all platforms
This commit is contained in:
Scott Mansell 2022-04-29 05:20:16 +12:00 committed by Admiral H. Curtiss
parent 876f6651b4
commit 4db1816368
No known key found for this signature in database
GPG Key ID: F051B4C4044F33FB
1 changed files with 17 additions and 6 deletions

View File

@ -16,8 +16,12 @@ set(CMAKE_OSX_DEPLOYMENT_TARGET "10.14.0" CACHE STRING "")
set(CMAKE_USER_MAKE_RULES_OVERRIDE "CMake/FlagsOverride.cmake")
# Required for cmake to select the correct runtime library in MSVC builds.
cmake_policy(SET CMP0091 NEW)
# Optionally enable these polcies so older versions of cmake don't break.
# we only need them for MSVC
if(POLICY CMP0091)
cmake_policy(SET CMP0091 NEW) # MSVC runtime library flags are selected by an abstraction.
cmake_policy(SET CMP0092 NEW) # MSVC warning flags are not in CMAKE_{C,CXX}_FLAGS by default.
endif()
project(dolphin-emu)
@ -247,7 +251,14 @@ elseif(CMAKE_GENERATOR MATCHES "Visual Studio")
add_compile_options("/MP")
endif()
if(CMAKE_C_COMPILER_ID MATCHES "MSVC")
if(MSVC)
if(POLICY CMP0091)
# cmake is a weird language. You can't do if(not POLICY)
else()
# We really kind of want this policy
message(FATAL_ERROR "please update cmake to at least 3.15")
endif()
check_and_add_flag(EXCEPTIONS /EHsc)
dolphin_compile_definitions(_DEBUG DEBUG_ONLY)