Commit 808edbcdca56e4f030a98bbe6c6dc4b5866ff2b5

Sam Lantinga 2022-06-29T17:24:57

Merge commit '6dcb2868b03b21a4cfacf0d5804ee07cfde0a0c7' into main

diff --git a/cmake/sdlchecks.cmake b/cmake/sdlchecks.cmake
index 09541ad..1df48bd 100644
--- a/cmake/sdlchecks.cmake
+++ b/cmake/sdlchecks.cmake
@@ -484,11 +484,19 @@ macro(CheckX11)
         else()
           set(HAVE_X11_SHARED TRUE)
         endif()
-        if(HAVE_X11_SHARED AND X11_LIB AND XEXT_LIB)
-          set(SDL_VIDEO_DRIVER_X11_DYNAMIC "\"${X11_LIB_SONAME}\"")
-          set(SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "\"${XEXT_LIB_SONAME}\"")
-        else()
-          list(APPEND EXTRA_LIBS ${X11_LIB} ${XEXT_LIB})
+        if(X11_LIB)
+          if(HAVE_X11_SHARED)
+            set(SDL_VIDEO_DRIVER_X11_DYNAMIC "\"${X11_LIB_SONAME}\"")
+          else()
+            list(APPEND EXTRA_LIBS ${X11_LIB})
+          endif()
+        endif()
+        if(XEXT_LIB)
+          if(HAVE_X11_SHARED)
+            set(SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "\"${XEXT_LIB_SONAME}\"")
+          else()
+            list(APPEND EXTRA_LIBS ${XEXT_LIB_SONAME})
+          endif()
         endif()
       else()
           list(APPEND EXTRA_LIBS ${X11_LIB} ${XEXT_LIB})