aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorpeak3d <pfau@peak3d.de>2018-07-22 21:15:42 +0200
committerpeak3d <pfau@peak3d.de>2018-07-22 21:16:06 +0200
commitf0f9028d7f6aabf1f5d4575dfe16057a2c07a7b4 (patch)
tree653ddb4a3de0b618f63f1f367536073939a36279 /cmake
parent56383d5b2c7d1d87e6ff876954214f22e73a2365 (diff)
Rework FindXkbcommon.cmake
Diffstat (limited to 'cmake')
-rw-r--r--cmake/modules/FindXkbcommon.cmake37
1 files changed, 28 insertions, 9 deletions
diff --git a/cmake/modules/FindXkbcommon.cmake b/cmake/modules/FindXkbcommon.cmake
index 1bb2543ef3..40cbb314d7 100644
--- a/cmake/modules/FindXkbcommon.cmake
+++ b/cmake/modules/FindXkbcommon.cmake
@@ -7,15 +7,34 @@
# XKBCOMMON_FOUND - the system has libxkbcommon
# XKBCOMMON_INCLUDE_DIRS - the libxkbcommon include directory
# XKBCOMMON_LIBRARIES - the libxkbcommon libraries
-# XKBCOMMON_DEFINITIONS - the libxkbcommon definitions
-pkg_check_modules (XKBCOMMON xkbcommon)
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_XKBCOMMON xkbcommon QUIET)
+endif()
-include (FindPackageHandleStandardArgs)
-find_package_handle_standard_args (Xkbcommon
- REQUIRED_VARS
- XKBCOMMON_FOUND)
-set(XKBCOMMON_DEFINITIONS -DHAVE_XKBCOMMON=1)
-set(XKBCOMMON_LIBRARIES ${XKBCOMMON_LDFLAGS})
-set(XKBCOMMON_INCLUDE_DIRS ${XKBCOMMON_INCLUDEDIR})
+find_path(XKBCOMMON_INCLUDE_DIR NAMES xkbcommon/xkbcommon.h
+ PATHS ${PC_XKBCOMMON_INCLUDEDIR})
+find_library(XKBCOMMON_LIBRARY NAMES xkbcommon
+ PATHS ${PC_XKBCOMMON_LIBDIR})
+
+set(XKBCOMMON_VERSION ${PC_XKBCOMMON_VERSION})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Xkbcommon
+ REQUIRED_VARS XKBCOMMON_LIBRARY XKBCOMMON_INCLUDE_DIR
+ VERSION_VAR XKBCOMMON_VERSION)
+
+if(XKBCOMMON_FOUND)
+ set(XKBCOMMON_INCLUDE_DIRS ${XKBCOMMON_INCLUDE_DIR})
+ set(XKBCOMMON_LIBRARIES ${XKBCOMMON_LIBRARY})
+
+ if(NOT TARGET XKBCOMMON::XKBCOMMON)
+ add_library(XKBCOMMON::XKBCOMMON UNKNOWN IMPORTED)
+ set_target_properties(XKBCOMMON::XKBCOMMON PROPERTIES
+ IMPORTED_LOCATION "${XKBCOMMON_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${XKBCOMMON_INCLUDE_DIR}")
+ endif()
+endif()
+
+mark_as_advanced(XKBCOMMON_INCLUDE_DIR XKBCOMMON_LIBRARY)