Issue an error when using a MinGW UCRT version

This commit is contained in:
Lukas Dürrenberger 2023-12-10 15:10:07 +01:00
parent c1c65b53ec
commit c9d065a054
2 changed files with 16 additions and 5 deletions

View File

@ -195,6 +195,8 @@ if(SFML_USE_SYSTEM_DEPS)
endforeach() endforeach()
list(REMOVE_DUPLICATES CMAKE_IGNORE_PATH) list(REMOVE_DUPLICATES CMAKE_IGNORE_PATH)
elseif(SFML_COMPILER_GCC AND GCC_COMPILER_VERSION MATCHES "ucrt")
message(FATAL_ERROR "The pre-compiled SFML dependencies for MinGW are not compatible with the UCRT. Either switch to the MSVCRT or build the dependencies yourself.")
endif() endif()
# Visual C++: remove warnings regarding SL security and algorithms on pointers # Visual C++: remove warnings regarding SL security and algorithms on pointers

View File

@ -8,6 +8,7 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
# detect the architecture (note: this test won't work for cross-compilation) # detect the architecture (note: this test won't work for cross-compilation)
include(CheckTypeSize) include(CheckTypeSize)
check_type_size(void* SIZEOF_VOID_PTR) check_type_size(void* SIZEOF_VOID_PTR)
if(${SIZEOF_VOID_PTR} STREQUAL "4") if(${SIZEOF_VOID_PTR} STREQUAL "4")
set(ARCH_32BITS 1) set(ARCH_32BITS 1)
elseif(${SIZEOF_VOID_PTR} STREQUAL "8") elseif(${SIZEOF_VOID_PTR} STREQUAL "8")
@ -18,25 +19,31 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
endif() endif()
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set(SFML_OS_UNIX 1) set(SFML_OS_UNIX 1)
if(ANDROID) if(ANDROID)
set(SFML_OS_ANDROID 1) set(SFML_OS_ANDROID 1)
# use the OpenGL ES implementation on Android # use the OpenGL ES implementation on Android
set(OPENGL_ES 1) set(OPENGL_ES 1)
else() else()
set(SFML_OS_LINUX 1) set(SFML_OS_LINUX 1)
# don't use the OpenGL ES implementation on Linux # don't use the OpenGL ES implementation on Linux
set(OPENGL_ES 0) set(OPENGL_ES 0)
endif() endif()
elseif(CMAKE_SYSTEM_NAME MATCHES "^k?FreeBSD$") elseif(CMAKE_SYSTEM_NAME MATCHES "^k?FreeBSD$")
set(SFML_OS_FREEBSD 1) set(SFML_OS_FREEBSD 1)
# don't use the OpenGL ES implementation on FreeBSD # don't use the OpenGL ES implementation on FreeBSD
set(OPENGL_ES 0) set(OPENGL_ES 0)
elseif(CMAKE_SYSTEM_NAME MATCHES "^OpenBSD$") elseif(CMAKE_SYSTEM_NAME MATCHES "^OpenBSD$")
set(SFML_OS_OPENBSD 1) set(SFML_OS_OPENBSD 1)
# don't use the OpenGL ES implementation on OpenBSD # don't use the OpenGL ES implementation on OpenBSD
set(OPENGL_ES 0) set(OPENGL_ES 0)
elseif(CMAKE_SYSTEM_NAME MATCHES "^NetBSD$") elseif(CMAKE_SYSTEM_NAME MATCHES "^NetBSD$")
set(SFML_OS_NETBSD 1) set(SFML_OS_NETBSD 1)
# don't use the OpenGL ES implementation on NetBSD # don't use the OpenGL ES implementation on NetBSD
set(OPENGL_ES 0) set(OPENGL_ES 0)
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
@ -54,6 +61,7 @@ elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
# detect OS X version. (use '/usr/bin/sw_vers -productVersion' to extract V from '10.V.x'.) # detect OS X version. (use '/usr/bin/sw_vers -productVersion' to extract V from '10.V.x'.)
EXEC_PROGRAM(/usr/bin/sw_vers ARGS -productVersion OUTPUT_VARIABLE MACOSX_VERSION_RAW) EXEC_PROGRAM(/usr/bin/sw_vers ARGS -productVersion OUTPUT_VARIABLE MACOSX_VERSION_RAW)
STRING(REGEX REPLACE "10\\.([0-9]+).*" "\\1" MACOSX_VERSION "${MACOSX_VERSION_RAW}") STRING(REGEX REPLACE "10\\.([0-9]+).*" "\\1" MACOSX_VERSION "${MACOSX_VERSION_RAW}")
if(${MACOSX_VERSION} LESS 7) if(${MACOSX_VERSION} LESS 7)
message(FATAL_ERROR "Unsupported version of OS X: ${MACOSX_VERSION_RAW}") message(FATAL_ERROR "Unsupported version of OS X: ${MACOSX_VERSION_RAW}")
return() return()
@ -64,6 +72,7 @@ elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Android")
# use the OpenGL ES implementation on Android # use the OpenGL ES implementation on Android
set(OPENGL_ES 1) set(OPENGL_ES 1)
# comparing CMAKE_SYSTEM_NAME with "CYGWIN" generates a false warning depending on the CMake version # comparing CMAKE_SYSTEM_NAME with "CYGWIN" generates a false warning depending on the CMake version
# let's avoid it so the actual error is more visible # let's avoid it so the actual error is more visible
elseif(${CYGWIN}) elseif(${CYGWIN})
@ -100,9 +109,9 @@ if(MSVC)
set(SFML_MSVC_VERSION 17) set(SFML_MSVC_VERSION 17)
endif() endif()
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(SFML_COMPILER_CLANG_CL 1) set(SFML_COMPILER_CLANG_CL 1)
endif() endif()
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(SFML_COMPILER_CLANG 1) set(SFML_COMPILER_CLANG 1)