cmake: fail configuring when no X11 or wayland could be found ()

It's still possible to build SDL by configuring with -DSDL_NO_UNIX_DESKTOP_SANITY_CHECK=ON
This commit is contained in:
Anonymous Maarten 2024-10-23 22:19:40 +02:00 committed by GitHub
parent 540db0d164
commit e8b69b03fe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 27 additions and 5 deletions

View file

@ -394,11 +394,21 @@ function(SDL_PrintSummary)
message(STATUS "")
endif()
if(UNIX AND NOT (ANDROID OR APPLE OR EMSCRIPTEN))
if(UNIX AND NOT (ANDROID OR APPLE OR EMSCRIPTEN OR HAIKU OR RISCOS))
if(NOT (HAVE_X11 OR HAVE_WAYLAND))
message(STATUS "SDL is being built without a X11 or wayland video driver.")
message(STATUS "The library will not be able to create windows on most unix environments.")
message(STATUS "")
if(NOT SDL_UNIX_CONSOLE_BUILD)
message(FATAL_ERROR
"SDL could not find X11 or Wayland development libraries on your system. "
"This means SDL will not be able to create windows on a typical unix operating system. "
"Most likely, this is not wanted."
"\n"
"On Linux, install the packages listed at "
"https://github.com/libsdl-org/SDL/blob/main/docs/README-linux.md#build-dependencies "
"\n"
"If you really don't need desktop windows, the documentation tells you how to skip this check. "
"https://github.com/libsdl-org/SDL/blob/main/docs/README-cmake.md#cmake-fails-to-build-without-x11-or-wayland-support\n"
)
endif()
endif()
endif()
endfunction()