SDL: Fix joystick (/dev/input/xxx) support on FreeBSD (f08f4)

From f08f458896d99f63b829c994623f8b9701d7eaf9 Mon Sep 17 00:00:00 2001
From: Ganael Laplanche <[EMAIL REDACTED]>
Date: Sat, 22 Jun 2024 18:14:16 +0200
Subject: [PATCH] Fix joystick (/dev/input/xxx) support on FreeBSD

Backport f8ad4abe from main branch.

When switching to CMake, src/joystick/linux/SDL_sysjoystick.c file got
excluded from FreeBSD builds, losing support for /dev/input/xxx devices.

See also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=279907
and: https://github.com/libsdl-org/SDL/pull/10087

(cherry picked from commit ab5740bde2ac593f5a6821ec2ac3800cdfcaf754)
---
 CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8b5bd7056535d..a98d3cc6e4b84 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1674,7 +1674,7 @@ elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU)
     if(FREEBSD OR NETBSD OR OPENBSD OR BSDI)
       CheckUSBHID()
     endif()
-    if(LINUX AND HAVE_LINUX_INPUT_H AND NOT ANDROID)
+    if((LINUX OR FREEBSD) AND HAVE_LINUX_INPUT_H AND NOT ANDROID)
       set(SDL_JOYSTICK_LINUX 1)
       file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/linux/*.c ${SDL2_SOURCE_DIR}/src/joystick/steam/*.c)
       list(APPEND SOURCE_FILES ${JOYSTICK_SOURCES})