summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Vandaƫle <joshua@vandaele.software>2026-07-14 16:37:31 +0200
committerJoshua Vandaƫle <joshua@vandaele.software>2026-07-25 04:32:28 +0200
commit13238340ae77350f7f7bb13f1e93e52afc450afe (patch)
tree180e36d76ab883cdd91c68082c62a0b59a550300
parentf98c974a0de833b14def482d512cb5126d436f57 (diff)
CMake: Enforce minimum toolset versions
-rw-r--r--CMake/DolphinLibraryTools.cmake10
-rw-r--r--CMakeLists.txt35
2 files changed, 30 insertions, 15 deletions
diff --git a/CMake/DolphinLibraryTools.cmake b/CMake/DolphinLibraryTools.cmake
index bedba9dcbd..7d62966fc7 100644
--- a/CMake/DolphinLibraryTools.cmake
+++ b/CMake/DolphinLibraryTools.cmake
@@ -138,3 +138,13 @@ function(dolphin_find_optional_system_library_pkgconfig library search alias bun
dolphin_add_bundled_library(${library} ${use_system} ${bundled_path})
endif()
endfunction()
+
+function(dolphin_check_toolset_version LABEL VERSION_VAR MIN_VERSION)
+ if(NOT DEFINED ${VERSION_VAR})
+ return()
+ endif()
+ message(STATUS "Using ${LABEL} ${${VERSION_VAR}}")
+ if(${VERSION_VAR} VERSION_LESS ${MIN_VERSION})
+ message(FATAL_ERROR "Requires ${LABEL} ${MIN_VERSION} or higher")
+ endif()
+endfunction()
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8dc8606253..389e8ae7ee 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -19,6 +19,18 @@ set(CMAKE_CXX_SCAN_FOR_MODULES OFF)
project(dolphin-emu)
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMake)
+
+# Support functions
+include(CheckAndAddFlag)
+include(CheckCCompilerFlag)
+include(CheckSymbolExists)
+include(DolphinCompileDefinitions)
+include(DolphinDisableWarningsMSVC)
+include(DolphinLibraryTools)
+include(GNUInstallDirs)
+include(RemoveCompileFlag)
+
# When using the Visual Studio generator, only show our targets and not the ones from Externals.
set_property(DIRECTORY ${PROJECT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT dolphin-emu)
@@ -33,12 +45,19 @@ if (COMPILER STREQUAL "GNU")
set(COMPILER "GCC") # prefer printing GCC instead of GNU
endif()
-# Enforce minimum compiler versions that support the C++23 features we use
+# Minimum required versions
+# Toolsets
+set(Xcode_min_version 14.3)
+set(MSVC_toolset_min_version 143)
+# Compilers
set(GCC_min_version 12)
set(Clang_min_version 15)
set(AppleClang_min_version 14.0.3)
set(MSVC_min_version 19.32)
+dolphin_check_toolset_version("Xcode" XCODE_VERSION ${Xcode_min_version})
+dolphin_check_toolset_version("MSVC Toolset" MSVC_TOOLSET_VERSION ${MSVC_toolset_min_version})
+
message(STATUS "Using ${COMPILER} ${CMAKE_CXX_COMPILER_VERSION}")
if(NOT DEFINED ${COMPILER}_min_version)
@@ -136,20 +155,6 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
endif()
endif()
-list(APPEND CMAKE_MODULE_PATH
- ${CMAKE_CURRENT_SOURCE_DIR}/CMake
-)
-
-# Support functions
-include(CheckAndAddFlag)
-include(CheckCCompilerFlag)
-include(CheckSymbolExists)
-include(DolphinCompileDefinitions)
-include(DolphinDisableWarningsMSVC)
-include(DolphinLibraryTools)
-include(GNUInstallDirs)
-include(RemoveCompileFlag)
-
# Enable folders for IDE
set_property(GLOBAL PROPERTY USE_FOLDERS ON)