cmake: Build Linux-specific files like the configure script does. Otherwise we unconditionally compile things we shouldn't. Fixes Bugzilla #5175.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b876fc6..62356fa 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1185,9 +1185,6 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID AND NOT RISCOS)
ioctl(0, KDGKBENT, &kbe);
}" HAVE_INPUT_KD)
- file(GLOB CORE_LINUX_SOURCES ${SDL2_SOURCE_DIR}/src/core/linux/*.c)
- set(SOURCE_FILES ${SOURCE_FILES} ${CORE_LINUX_SOURCES})
-
if(HAVE_INPUT_EVENTS)
set(SDL_INPUT_LINUXEV 1)
endif()
@@ -1223,7 +1220,8 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID AND NOT RISCOS)
endif()
if (HAVE_IBUS_IBUS_H OR HAVE_FCITX)
- add_definitions(-DSDL_USE_IME)
+ set(SDL_USE_IME TRUE)
+ add_definitions(-DSDL_USE_IME) # !!! FIXME: why isn't this a definition and not in SDL_config.h.cmake?
endif()
if(HAVE_LIBUNWIND_H)
# We've already found the header, so REQUIRE the lib to be present
@@ -1232,6 +1230,36 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID AND NOT RISCOS)
list(APPEND EXTRA_LIBS ${UNWIND_LIBRARIES} ${UNWIND_GENERIC_LIBRARIES})
endif()
endif()
+
+ if(HAVE_DBUS_DBUS_H)
+ set(SOURCE_FILES ${SOURCE_FILES} "${SDL2_SOURCE_DIR}/src/core/linux/SDL_dbus.c")
+ endif()
+
+ if(SDL_USE_IME)
+ set(SOURCE_FILES ${SOURCE_FILES} "${SDL2_SOURCE_DIR}/src/core/linux/SDL_ime.c")
+ endif()
+
+ if(HAVE_IBUS_IBUS_H)
+ set(SOURCE_FILES ${SOURCE_FILES} "${SDL2_SOURCE_DIR}/src/core/linux/SDL_ibus.c")
+ endif()
+
+ if(HAVE_FCITX)
+ set(SOURCE_FILES ${SOURCE_FILES} "${SDL2_SOURCE_DIR}/src/core/linux/SDL_fcitx.c")
+ endif()
+
+ if(HAVE_LIBUDEV_H)
+ set(SOURCE_FILES ${SOURCE_FILES} "${SDL2_SOURCE_DIR}/src/core/linux/SDL_udev.c")
+ endif()
+
+ if(HAVE_INPUT_EVENTS)
+ set(SOURCE_FILES ${SOURCE_FILES} "${SDL2_SOURCE_DIR}/src/core/linux/SDL_evdev.c")
+ set(SOURCE_FILES ${SOURCE_FILES} "${SDL2_SOURCE_DIR}/src/core/linux/SDL_evdev_kbd.c")
+ endif()
+
+ # Always compiled for Linux, unconditionally:
+ set(SOURCE_FILES ${SOURCE_FILES} "${SDL2_SOURCE_DIR}/src/core/linux/SDL_threadprio.c")
+
+ # src/core/unix/*.c is included in a generic if(UNIX) section, elsewhere.
endif()
if(INPUT_TSLIB)