mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2026-01-15 16:33:15 -03:00
Set CMake version range to 3.20...4.2.1
CMake support for c++23 was added in 3.20. Remove statements explicitly setting the following policies to NEW. These policies were introduced in or before 3.20, and now that 3.20 is the minimum version they will automatically have the NEW behavior. Policy: Introduced in CMP0079: 3.13 CMP0084: 3.14 CMP0091: 3.15 CMP0092: 3.15 CMP0099: 3.17 CMP0117: 3.20 Disable scanning c++ source files for module imports (introduced as CMP0155 in 3.28) since we don't use modules and that policy triggers build errors with Clang if the clang-scan-deps tool isn't installed.
This commit is contained in:
@@ -1,23 +1,10 @@
|
||||
########################################
|
||||
# General setup
|
||||
#
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
cmake_minimum_required(VERSION 3.20...4.2.1)
|
||||
|
||||
cmake_policy(SET CMP0079 NEW) # let target_link_libraries() link to a target defined in a different directory
|
||||
cmake_policy(SET CMP0080 OLD) # allow using BundleUtilities at configure time
|
||||
|
||||
if (POLICY CMP0099)
|
||||
cmake_policy(SET CMP0099 NEW) # Propagate INTERFACE_LINK_OPTIONS from private dependencies, used by MacOS framework builds of SDL
|
||||
endif()
|
||||
|
||||
# Weird chicken-and-egg problem: We can't check the compiler before the project() call, but we have to set the policies before it.
|
||||
# So we do this in two steps: Set the policies if they exist, then error out afterwards if we end up being MSVC and they don't exist.
|
||||
if (POLICY CMP0117)
|
||||
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.
|
||||
cmake_policy(SET CMP0117 NEW) # MSVC RTTI flag will not be added by default.
|
||||
endif()
|
||||
|
||||
if (POLICY CMP0141)
|
||||
cmake_policy(SET CMP0141 NEW) # MSVC debug information format flags are selected by an abstraction.
|
||||
endif()
|
||||
@@ -28,6 +15,12 @@ set(CMAKE_OSX_DEPLOYMENT_TARGET "11.0.0" CACHE STRING "")
|
||||
|
||||
set(CMAKE_USER_MAKE_RULES_OVERRIDE "${CMAKE_CURRENT_SOURCE_DIR}/CMake/FlagsOverride.cmake")
|
||||
|
||||
# CMake 3.28 and later scan c++ source files for module imports by default. Since we don't use
|
||||
# modules scanning is pointless, so disable it. This also prevents Clang from generating an error
|
||||
# if the clang-scan-deps tool isn't installed:
|
||||
# "CMAKE_CXX_COMPILER_CLANG_SCAN_DEPS-NOTFOUND: not found".
|
||||
set(CMAKE_CXX_SCAN_FOR_MODULES OFF)
|
||||
|
||||
project(dolphin-emu)
|
||||
|
||||
if (CMAKE_VERSION VERSION_LESS "3.25" AND CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
@@ -35,12 +28,6 @@ if (CMAKE_VERSION VERSION_LESS "3.25" AND CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
if (POLICY CMP0117)
|
||||
# cmake is a weird language. You can't do if(not POLICY)
|
||||
else()
|
||||
message(FATAL_ERROR "Please update to CMake 3.20 or higher.")
|
||||
endif()
|
||||
|
||||
set(CMAKE_C_STANDARD 99)
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
if(POLICY CMP0084)
|
||||
# Disable trying to search for Qt3/4 if what we actually want is not found
|
||||
cmake_policy(SET CMP0084 NEW)
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
if(_M_ARM_64)
|
||||
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_SOURCE_DIR}/Externals/Qt/Qt6.5.1/ARM64")
|
||||
|
||||
Reference in New Issue
Block a user