[cosmetic] separate c-lang format commit
[xbmc.git] / cmake / modules / FindXkbcommon.cmake
blob5fbda7a1e85eed987f9a688beda9d7e14ba505b7
1 # FindXkbcommon
2 # -----------
3 # Finds the libxkbcommon library
5 # This will define the following target:
7 #   ${APP_NAME_LC}::Xkbcommon   - The libxkbcommon library
9 if(NOT TARGET ${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME})
10   find_package(PkgConfig)
11   if(PKG_CONFIG_FOUND)
12     pkg_check_modules(PC_XKBCOMMON xkbcommon QUIET)
13   endif()
15   find_path(XKBCOMMON_INCLUDE_DIR NAMES xkbcommon/xkbcommon.h
16                                   HINTS ${PC_XKBCOMMON_INCLUDEDIR})
17   find_library(XKBCOMMON_LIBRARY NAMES xkbcommon
18                                  HINTS ${PC_XKBCOMMON_LIBDIR})
20   set(XKBCOMMON_VERSION ${PC_XKBCOMMON_VERSION})
22   include(FindPackageHandleStandardArgs)
23   find_package_handle_standard_args(Xkbcommon
24                                     REQUIRED_VARS XKBCOMMON_LIBRARY XKBCOMMON_INCLUDE_DIR
25                                     VERSION_VAR XKBCOMMON_VERSION)
27   if(XKBCOMMON_FOUND)
28     add_library(${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME} UNKNOWN IMPORTED)
29     set_target_properties(${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME} PROPERTIES
30                                                                      IMPORTED_LOCATION "${XKBCOMMON_LIBRARY}"
31                                                                      INTERFACE_INCLUDE_DIRECTORIES "${XKBCOMMON_INCLUDE_DIR}")
32   endif()
33 endif()