cmake: Fix bug #5361. src/joystick/*.c wasn't unconditionally added to source list even though joystick is an SDL subsystem. Also removed the `SDL_JOYSTICK AND NOT APPLE` condition from src/joystick/dummy/*.c source addition: the OSX unresolved symbols issue, if it really is there, should be fixed separately. Fixes https://github.com/libsdl-org/SDL/issues/5361, i.e. build failures when SDL_JOYSTICK and SDL_HAPTIC are disabled.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 26fc330..1561ca2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -471,6 +471,7 @@ file(GLOB SOURCE_FILES
${SDL2_SOURCE_DIR}/src/dynapi/*.c
${SDL2_SOURCE_DIR}/src/events/*.c
${SDL2_SOURCE_DIR}/src/file/*.c
+ ${SDL2_SOURCE_DIR}/src/joystick/*.c
${SDL2_SOURCE_DIR}/src/haptic/*.c
${SDL2_SOURCE_DIR}/src/hidapi/*.c
${SDL2_SOURCE_DIR}/src/libm/*.c
@@ -961,10 +962,6 @@ foreach(_SUB ${SDL_SUBSYSTEMS})
set(SDL_${_OPT}_DISABLED 1)
endif()
endforeach()
-if(SDL_JOYSTICK)
- file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/*.c)
- set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES})
-endif()
if(SDL_HAPTIC)
if(NOT SDL_JOYSTICK)
# Haptic requires some private functions from the joystick subsystem.
@@ -2558,10 +2555,8 @@ if(NOT HAVE_SDL_VIDEO)
endif()
if(NOT HAVE_SDL_JOYSTICK)
set(SDL_JOYSTICK_DUMMY 1)
- if(SDL_JOYSTICK AND NOT APPLE) # results in unresolved symbols on OSX
- file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/dummy/*.c)
- set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES})
- endif()
+ file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/dummy/*.c)
+ set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES})
endif()
if(NOT HAVE_SDL_HAPTIC)
set(SDL_HAPTIC_DUMMY 1)