diff options
author | Tim Blechmann <tim@klingt.org> | 2020-08-10 08:23:56 (GMT) |
---|---|---|
committer | Tim Blechmann <tim@klingt.org> | 2020-08-12 06:01:01 (GMT) |
commit | 6d231b494f2b583b4c5b425bee87f6b6a9cb8725 (patch) | |
tree | 413a2fd976aa91e90e41d8a9fb97db2a989feb1f | |
parent | 514292ab0ff9404c25f1e28c9e17b71f1a3f7932 (diff) | |
download | CMake-6d231b494f2b583b4c5b425bee87f6b6a9cb8725.zip CMake-6d231b494f2b583b4c5b425bee87f6b6a9cb8725.tar.gz CMake-6d231b494f2b583b4c5b425bee87f6b6a9cb8725.tar.bz2 |
FindX11: Add xcb_util and xcb_xfixes libraries
-rw-r--r-- | Modules/FindX11.cmake | 28 | ||||
-rw-r--r-- | Tests/FindX11/Test/CMakeLists.txt | 4 | ||||
-rw-r--r-- | Tests/FindX11/Test/main.c | 48 |
3 files changed, 80 insertions, 0 deletions
diff --git a/Modules/FindX11.cmake b/Modules/FindX11.cmake index 958a22e..262dda0 100644 --- a/Modules/FindX11.cmake +++ b/Modules/FindX11.cmake @@ -28,6 +28,8 @@ and also the following more fine grained variables and targets: X11_xcb_INCLUDE_PATH, X11_xcb_LIB, X11_xcb_FOUND, X11::xcb X11_X11_xcb_INCLUDE_PATH, X11_X11_xcb_LIB, X11_X11_xcb_FOUND, X11::X11_xcb X11_xcb_icccm_INCLUDE_PATH, X11_xcb_icccm_LIB, X11_xcb_icccm_FOUND, X11::xcb_icccm + X11_xcb_util_INCLUDE_PATH, X11_xcb_util_LIB, X11_xcb_util_FOUND, X11::xcb_util + X11_xcb_xfixes_INCLUDE_PATH, X11_xcb_xfixes_LIB, X11_xcb_xfixes_FOUND, X11::xcb_xfixes X11_xcb_xkb_INCLUDE_PATH, X11_xcb_xkb_LIB, X11_xcb_xkb_FOUND, X11::xcb_xkb X11_Xcomposite_INCLUDE_PATH, X11_Xcomposite_LIB, X11_Xcomposite_FOUND, X11::Xcomposite X11_Xcursor_INCLUDE_PATH, X11_Xcursor_LIB, X11_Xcursor_FOUND, X11::Xcursor @@ -105,6 +107,8 @@ if (UNIX) find_path(X11_xcb_INCLUDE_PATH xcb/xcb.h ${X11_INC_SEARCH_PATH}) find_path(X11_X11_xcb_INCLUDE_PATH X11/Xlib-xcb.h ${X11_INC_SEARCH_PATH}) find_path(X11_xcb_icccm_INCLUDE_PATH xcb/xcb_icccm.h ${X11_INC_SEARCH_PATH}) + find_path(X11_xcb_util_INCLUDE_PATH xcb/xcb_aux.h ${X11_INC_SEARCH_PATH}) + find_path(X11_xcb_xfixes_INCLUDE_PATH xcb/xfixes.h ${X11_INC_SEARCH_PATH}) find_path(X11_Xcomposite_INCLUDE_PATH X11/extensions/Xcomposite.h ${X11_INC_SEARCH_PATH}) find_path(X11_Xcursor_INCLUDE_PATH X11/Xcursor/Xcursor.h ${X11_INC_SEARCH_PATH}) find_path(X11_Xdamage_INCLUDE_PATH X11/extensions/Xdamage.h ${X11_INC_SEARCH_PATH}) @@ -156,6 +160,8 @@ if (UNIX) find_library(X11_xcb_LIB xcb ${X11_LIB_SEARCH_PATH}) find_library(X11_X11_xcb_LIB X11-xcb ${X11_LIB_SEARCH_PATH}) find_library(X11_xcb_icccm_LIB xcb-icccm ${X11_LIB_SEARCH_PATH}) + find_library(X11_xcb_util_LIB xcb-util ${X11_LIB_SEARCH_PATH}) + find_library(X11_xcb_xfixes_LIB xcb-xfixes ${X11_LIB_SEARCH_PATH}) find_library(X11_xcb_xkb_LIB xcb-xkb ${X11_LIB_SEARCH_PATH}) find_library(X11_Xcomposite_LIB Xcomposite ${X11_LIB_SEARCH_PATH}) find_library(X11_Xcursor_LIB Xcursor ${X11_LIB_SEARCH_PATH}) @@ -255,6 +261,14 @@ if (UNIX) set(X11_xcb_icccm_FOUND TRUE) endif () + if (X11_xcb_util_LIB AND X11_xcb_util_INCLUDE_PATH) + set(X11_xcb_util_FOUND TRUE) + endif () + + if (X11_xcb_xfixes_LIB) + set(X11_xcb_xfixes_FOUND TRUE) + endif () + if (X11_xcb_xkb_LIB) set(X11_xcb_xkb_FOUND TRUE) endif () @@ -558,6 +572,20 @@ if (UNIX) INTERFACE_LINK_LIBRARIES "X11::xcb") endif () + if (X11_xcb_util_FOUND AND NOT TARGET X11::xcb_util) + add_library(X11::xcb_util UNKNOWN IMPORTED) + set_target_properties(X11::xcb_util PROPERTIES + IMPORTED_LOCATION "${X11_xcb_util_LIB}" + INTERFACE_LINK_LIBRARIES "X11::xcb") + endif () + + if (X11_xcb_xfixes_FOUND AND NOT TARGET X11::xcb_xfixes) + add_library(X11::xcb_xfixes UNKNOWN IMPORTED) + set_target_properties(X11::xcb_xfixes PROPERTIES + IMPORTED_LOCATION "${X11_xcb_xfixes_LIB}" + INTERFACE_LINK_LIBRARIES "X11::xcb") + endif () + if (X11_xcb_xkb_FOUND AND NOT TARGET X11::xcb_xkb) add_library(X11::xcb_xkb UNKNOWN IMPORTED) set_target_properties(X11::xcb_xkb PROPERTIES diff --git a/Tests/FindX11/Test/CMakeLists.txt b/Tests/FindX11/Test/CMakeLists.txt index 7325b32..5b304d9 100644 --- a/Tests/FindX11/Test/CMakeLists.txt +++ b/Tests/FindX11/Test/CMakeLists.txt @@ -33,6 +33,8 @@ test_x11_component(x11_components Xaw) test_x11_component(x11_components xcb) test_x11_component(x11_components X11_xcb) test_x11_component(x11_components xcb_icccm) +test_x11_component(x11_components xcb_util) +test_x11_component(x11_components xcb_xfixes) test_x11_component(x11_components xcb_xkb) test_x11_component(x11_components Xcomposite) test_x11_component(x11_components Xdamage) @@ -72,6 +74,8 @@ foreach(lib xcb X11_xcb xcb_icccm + xcb_util + xcb_xfixes Xcomposite Xdamage Xdmcp diff --git a/Tests/FindX11/Test/main.c b/Tests/FindX11/Test/main.c index f8c723c..b44ae28 100644 --- a/Tests/FindX11/Test/main.c +++ b/Tests/FindX11/Test/main.c @@ -326,6 +326,44 @@ static void test_Xaw(void) #endif +#ifdef HAVE_xcb +# include <xcb/xcb.h> + +static void test_xcb(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_disconnect(connection); +} + +# ifdef HAVE_xcb_util +# include <xcb/xcb_aux.h> + +static void test_xcb_util(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_screen_t* screen = xcb_aux_get_screen(connection, screen_nbr); + xcb_disconnect(connection); +} + +# endif + +# ifdef HAVE_xcb_xfixes +# include <xcb/xcb_xfixes.h> + +static void test_xcb_xfixes(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_xfixes_query_version(connection, 1, 0); + xcb_disconnect(connection); +} + +# endif + +#endif + #include <stddef.h> int main(int argc, char* argv[]) @@ -413,6 +451,16 @@ int main(int argc, char* argv[]) #ifdef HAVE_X11_Xaw test_Xaw, #endif +#ifdef HAVE_xcb + test_xcb, +#endif +#ifdef HAVE_xcb_util + test_xcb_util, +#endif +#ifdef HAVE_xcb_xfixes + test_xcb_xfixes, +#endif + NULL, }; |