0

I am making a IME with iBus. I am wanting to use cmake as build environment. But there is no documentation about linking iBus(libibus). I need glib also. My coding language is C, C++. I need help please!

Thanks Sorry for bad English!

2
  • Have you tried anything so far?
    – HeyYO
    Nov 20, 2015 at 18:37
  • I haven't worked with ibus and glib
    – Mominul
    Nov 20, 2015 at 18:54

1 Answer 1

1

To use glib and iBus(libibus) in cmake, you have to use pkgconfig module. Here is a example :

## Find GLib and iBus ##
FIND_PACKAGE(PkgConfig)
PKG_CHECK_MODULES(GLIB2 REQUIRED glib-2.0)
PKG_CHECK_MODULES(IBUS REQUIRED ibus-1.0)

The PKG_CHECK_MODULES function defines some variables to use them to link with your program. You can use them like these:

## Include and Link
INCLUDE_DIRECTORIES(${GLIB2_INCLUDE_DIRS} ${IBUS_INCLUDE_DIRS})
LINK_DIRECTORIES(${GLIB2_LIBRARY_DIRS} ${IBUS_LIBRARY_DIRS})

## Create your Executable and link it. `.....` your sources
ADD_EXECUTABLE(My_Prog .....)
## `....` place your created libraries
TARGET_LINK_LIBRARIES(My_Prog ${GLIB2_LIBRARIES} ${IBUS_LIBRARIES} ....)

Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.