kdelibs/cmake/modules/FindIBus.cmake
Ivailo Monev 1ba57b3b8d cmake: move GIO, IBus and SCIM modules from kde-extraapps
the modules were also rewritten

Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
2020-02-18 15:35:24 +00:00

54 lines
1.6 KiB
CMake

# - Try to find IBUS
# Once done this will define
#
# IBUS_FOUND - system has IBUS
# IBUS_INCLUDE_DIR - The include directory to use for the fontconfig headers
# IBUS_LIBRARIES - Link these to use IBUS
# IBUS_DEFINITIONS - Compiler switches required for using IBUS
# Copyright (c) 2020, Ivailo Monev, <xakepa10@gmail.com>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if(IBUS_INCLUDE_DIR AND IBUS_LIBRARIES)
set(IBUS_FIND_QUIETLY TRUE)
endif()
if(NOT WIN32)
include(FindPkgConfig)
pkg_check_modules(PC_IBUS QUIET ibus-1.0)
set(IBUS_INCLUDE_DIR ${PC_IBUS_INCLUDE_DIRS})
set(IBUS_LIBRARIES ${PC_IBUS_LIBRARIES})
endif()
set(IBUS_VERSION ${PC_IBUS_VERSION})
set(IBUS_DEFINITIONS ${PC_IBUS_CFLAGS_OTHER})
if(NOT IBUS_INCLUDE_DIR OR NOT IBUS_LIBRARIES)
find_path(IBUS_INCLUDE_DIR
NAMES ibus.h
PATH_SUFFIXES ibus-1.0
HINTS $ENV{IBUSDIR}/include
)
find_library(IBUS_LIBRARIES
NAMES ibus-1.0 ibus
HINTS $ENV{IBUSDIR}/lib
)
# IBUS requires Glib2 (gio-2.0, gobject-2.0 and glib-2.0)
find_package(GIO REQUIRED)
find_package(GLIB2 REQUIRED)
set(IBUS_INCLUDE_DIR ${IBUS_INCLUDE_DIR} ${GIO_INCLUDE_DIR} ${GLIB2_INCLUDE_DIR})
set(IBUS_LIBRARIES ${IBUS_LIBRARIES} ${GIO_LIBRARIES} ${GLIB2_LIBRARIES})
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(IBUS
VERSION_VAR IBUS_VERSION
REQUIRED_VARS IBUS_LIBRARIES IBUS_INCLUDE_DIR
)
mark_as_advanced(IBUS_INCLUDE_DIR IBUS_LIBRARIES)