diff --git a/CMakeLists.txt b/CMakeLists.txt index 5e63c62c66..8f432b77bb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/Source/Core/DolphinQt/CMakeLists.txt b/Source/Core/DolphinQt/CMakeLists.txt index cd49f7f108..1960e944bd 100644 --- a/Source/Core/DolphinQt/CMakeLists.txt +++ b/Source/Core/DolphinQt/CMakeLists.txt @@ -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")