Browse Source

Fixed building with cmake when fcitx isn't installed

Sam Lantinga 9 years ago
parent
commit
f3502c3c53
3 changed files with 8 additions and 0 deletions
  1. 2 0
      CMakeLists.txt
  2. 1 0
      include/SDL_config.h.cmake
  3. 5 0
      src/core/linux/SDL_fcitx.c

+ 2 - 0
CMakeLists.txt

@@ -916,6 +916,8 @@ elseif(UNIX AND NOT APPLE)
       endif()
       endif()
     endif()
     endif()
 
 
+    check_include_file("fcitx/frontend.h" HAVE_FCITX_FRONTEND_H)
+
   endif()
   endif()
 
 
   if(INPUT_TSLIB)
   if(INPUT_TSLIB)

+ 1 - 0
include/SDL_config.h.cmake

@@ -82,6 +82,7 @@
 #cmakedefine HAVE_LIBUDEV_H 1
 #cmakedefine HAVE_LIBUDEV_H 1
 #cmakedefine HAVE_DBUS_DBUS_H 1
 #cmakedefine HAVE_DBUS_DBUS_H 1
 #cmakedefine HAVE_IBUS_IBUS_H 1
 #cmakedefine HAVE_IBUS_IBUS_H 1
+#cmakedefine HAVE_FCITX_FRONTEND_H 1
 
 
 /* C library functions */
 /* C library functions */
 #cmakedefine HAVE_MALLOC 1
 #cmakedefine HAVE_MALLOC 1

+ 5 - 0
src/core/linux/SDL_fcitx.c

@@ -18,6 +18,9 @@
      misrepresented as being the original software.
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
   3. This notice may not be removed or altered from any source distribution.
 */
 */
+#include "SDL_config.h"
+
+#ifdef HAVE_FCITX_FRONTEND_H
 
 
 #include <fcitx/frontend.h>
 #include <fcitx/frontend.h>
 #include <unistd.h>
 #include <unistd.h>
@@ -545,4 +548,6 @@ SDL_Fcitx_PumpEvents()
     }
     }
 }
 }
 
 
+#endif /* HAVE_FCITX_FRONTEND_H */
+
 /* vi: set ts=4 sw=4 expandtab: */
 /* vi: set ts=4 sw=4 expandtab: */