diff options
Diffstat (limited to 'cmake/modules/FindXkbcommon.cmake')
| -rw-r--r-- | cmake/modules/FindXkbcommon.cmake | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/cmake/modules/FindXkbcommon.cmake b/cmake/modules/FindXkbcommon.cmake index 2a84fe5..40cbb31 100644 --- a/cmake/modules/FindXkbcommon.cmake +++ b/cmake/modules/FindXkbcommon.cmake | |||
| @@ -2,20 +2,39 @@ | |||
| 2 | # ----------- | 2 | # ----------- |
| 3 | # Finds the libxkbcommon library | 3 | # Finds the libxkbcommon library |
| 4 | # | 4 | # |
| 5 | # This will will define the following variables:: | 5 | # This will define the following variables:: |
| 6 | # | 6 | # |
| 7 | # XKBCOMMON_FOUND - the system has libxkbcommon | 7 | # XKBCOMMON_FOUND - the system has libxkbcommon |
| 8 | # XKBCOMMON_INCLUDE_DIRS - the libxkbcommon include directory | 8 | # XKBCOMMON_INCLUDE_DIRS - the libxkbcommon include directory |
| 9 | # XKBCOMMON_LIBRARIES - the libxkbcommon libraries | 9 | # XKBCOMMON_LIBRARIES - the libxkbcommon libraries |
| 10 | # XKBCOMMON_DEFINITIONS - the libxkbcommon definitions | ||
| 11 | 10 | ||
| 12 | pkg_check_modules (XKBCOMMON xkbcommon) | 11 | if(PKG_CONFIG_FOUND) |
| 12 | pkg_check_modules(PC_XKBCOMMON xkbcommon QUIET) | ||
| 13 | endif() | ||
| 13 | 14 | ||
| 14 | include (FindPackageHandleStandardArgs) | ||
| 15 | find_package_handle_standard_args (Xkbcommon | ||
| 16 | REQUIRED_VARS | ||
| 17 | XKBCOMMON_FOUND) | ||
| 18 | 15 | ||
| 19 | set(XKBCOMMON_DEFINITIONS -DHAVE_XKBCOMMON=1) | 16 | find_path(XKBCOMMON_INCLUDE_DIR NAMES xkbcommon/xkbcommon.h |
| 20 | set(XKBCOMMON_LIBRARIES ${XKBCOMMON_LDFLAGS}) | 17 | PATHS ${PC_XKBCOMMON_INCLUDEDIR}) |
| 21 | set(XKBCOMMON_INCLUDE_DIRS ${XKBCOMMON_INCLUDEDIR}) | 18 | find_library(XKBCOMMON_LIBRARY NAMES xkbcommon |
| 19 | PATHS ${PC_XKBCOMMON_LIBDIR}) | ||
| 20 | |||
| 21 | set(XKBCOMMON_VERSION ${PC_XKBCOMMON_VERSION}) | ||
| 22 | |||
| 23 | include(FindPackageHandleStandardArgs) | ||
| 24 | find_package_handle_standard_args(Xkbcommon | ||
| 25 | REQUIRED_VARS XKBCOMMON_LIBRARY XKBCOMMON_INCLUDE_DIR | ||
| 26 | VERSION_VAR XKBCOMMON_VERSION) | ||
| 27 | |||
| 28 | if(XKBCOMMON_FOUND) | ||
| 29 | set(XKBCOMMON_INCLUDE_DIRS ${XKBCOMMON_INCLUDE_DIR}) | ||
| 30 | set(XKBCOMMON_LIBRARIES ${XKBCOMMON_LIBRARY}) | ||
| 31 | |||
| 32 | if(NOT TARGET XKBCOMMON::XKBCOMMON) | ||
| 33 | add_library(XKBCOMMON::XKBCOMMON UNKNOWN IMPORTED) | ||
| 34 | set_target_properties(XKBCOMMON::XKBCOMMON PROPERTIES | ||
| 35 | IMPORTED_LOCATION "${XKBCOMMON_LIBRARY}" | ||
| 36 | INTERFACE_INCLUDE_DIRECTORIES "${XKBCOMMON_INCLUDE_DIR}") | ||
| 37 | endif() | ||
| 38 | endif() | ||
| 39 | |||
| 40 | mark_as_advanced(XKBCOMMON_INCLUDE_DIR XKBCOMMON_LIBRARY) | ||
