Fixed building with cmake when fcitx isn't installed
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
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9038abf..54a23f0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -916,6 +916,8 @@ elseif(UNIX AND NOT APPLE)
endif()
endif()
+ check_include_file("fcitx/frontend.h" HAVE_FCITX_FRONTEND_H)
+
endif()
if(INPUT_TSLIB)
diff --git a/include/SDL_config.h.cmake b/include/SDL_config.h.cmake
index 57a44b9..98c62a9 100644
--- a/include/SDL_config.h.cmake
+++ b/include/SDL_config.h.cmake
@@ -82,6 +82,7 @@
#cmakedefine HAVE_LIBUDEV_H 1
#cmakedefine HAVE_DBUS_DBUS_H 1
#cmakedefine HAVE_IBUS_IBUS_H 1
+#cmakedefine HAVE_FCITX_FRONTEND_H 1
/* C library functions */
#cmakedefine HAVE_MALLOC 1
diff --git a/src/core/linux/SDL_fcitx.c b/src/core/linux/SDL_fcitx.c
index 05361ff..eff8f7f 100644
--- a/src/core/linux/SDL_fcitx.c
+++ b/src/core/linux/SDL_fcitx.c
@@ -18,6 +18,9 @@
misrepresented as being the original software.
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 <unistd.h>
@@ -545,4 +548,6 @@ SDL_Fcitx_PumpEvents()
}
}
+#endif /* HAVE_FCITX_FRONTEND_H */
+
/* vi: set ts=4 sw=4 expandtab: */