diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2023-02-27 22:40:48 (GMT) |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2023-02-27 22:40:48 (GMT) |
commit | 0cca309dfd903845b924f301a12b43eb1510979b (patch) | |
tree | ed10057b3bc451a255e38ee6e6329f06712cfef9 | |
parent | e7d7710cf2ef1ef576820abe60b6ce05bfa43b41 (diff) | |
download | CMake-0cca309dfd903845b924f301a12b43eb1510979b.zip CMake-0cca309dfd903845b924f301a12b43eb1510979b.tar.gz CMake-0cca309dfd903845b924f301a12b43eb1510979b.tar.bz2 |
FindX11: support the xcb-{cursor,shape,xrm} components
Fixes: #24417
-rw-r--r-- | Modules/FindX11.cmake | 51 | ||||
-rw-r--r-- | Tests/FindX11/Test/CMakeLists.txt | 6 | ||||
-rw-r--r-- | Tests/FindX11/Test/main.c | 53 |
3 files changed, 110 insertions, 0 deletions
diff --git a/Modules/FindX11.cmake b/Modules/FindX11.cmake index 8e5a5f1..6f6483a 100644 --- a/Modules/FindX11.cmake +++ b/Modules/FindX11.cmake @@ -30,10 +30,13 @@ and also the following more fine grained variables and targets: X11_Xau_INCLUDE_PATH, X11_Xau_LIB, X11_Xau_FOUND, X11::Xau 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_cursor_INCLUDE_PATH, X11_xcb_cursor_LIB, X11_xcb_cursor_FOUND, X11::xcb_cursor X11_xcb_icccm_INCLUDE_PATH, X11_xcb_icccm_LIB, X11_xcb_icccm_FOUND, X11::xcb_icccm X11_xcb_randr_INCLUDE_PATH, X11_xcb_randr_LIB, X11_xcb_randr_FOUND, X11::xcb_randr + X11_xcb_shape_INCLUDE_PATH, X11_xcb_shape_LIB, X11_xcb_shape_FOUND, X11::xcb_shape 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_xrm_INCLUDE_PATH, X11_xcb_xrm_LIB, X11_xcb_xrm_FOUND, X11::xcb_xrm X11_xcb_xtest_INCLUDE_PATH, X11_xcb_xtest_LIB, X11_xcb_xtest_FOUND, X11::xcb_xtest X11_xcb_keysyms_INCLUDE_PATH, X11_xcb_keysyms_LIB,X11_xcb_keysyms_FOUND,X11::xcb_keysyms X11_xcb_xkb_INCLUDE_PATH, X11_xcb_xkb_LIB, X11_xcb_xkb_FOUND, X11::xcb_xkb @@ -88,6 +91,9 @@ and also the following more fine grained variables and targets: .. versionadded:: 3.24 Added the ``xcb_randr``, ``xcb_xtext``, and ``xcb_keysyms`` libraries. +.. versionadded:: 3.27 + Added the ``xcb_cursor``, ``xcb_shape``, and ``xcb_xrm`` libraries. + #]=======================================================================] if (UNIX) @@ -132,10 +138,13 @@ if (UNIX) find_path(X11_Xaw_INCLUDE_PATH X11/Xaw/Intrinsic.h ${X11_INC_SEARCH_PATH}) 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_cursor_INCLUDE_PATH xcb/xcb_cursor.h ${X11_INC_SEARCH_PATH}) find_path(X11_xcb_icccm_INCLUDE_PATH xcb/xcb_icccm.h ${X11_INC_SEARCH_PATH}) find_path(X11_xcb_randr_INCLUDE_PATH xcb/randr.h ${X11_INC_SEARCH_PATH}) + find_path(X11_xcb_shape_INCLUDE_PATH xcb/shape.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_xcb_xrm_INCLUDE_PATH xcb/xcb_xrm.h ${X11_INC_SEARCH_PATH}) find_path(X11_xcb_xtest_INCLUDE_PATH xcb/xtest.h ${X11_INC_SEARCH_PATH}) find_path(X11_xcb_keysyms_INCLUDE_PATH xcb/xcb_keysyms.h ${X11_INC_SEARCH_PATH}) find_path(X11_Xcomposite_INCLUDE_PATH X11/extensions/Xcomposite.h ${X11_INC_SEARCH_PATH}) @@ -188,10 +197,13 @@ if (UNIX) find_library(X11_Xaw_LIB Xaw ${X11_LIB_SEARCH_PATH}) 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_cursor_LIB xcb-cursor ${X11_LIB_SEARCH_PATH}) find_library(X11_xcb_icccm_LIB xcb-icccm ${X11_LIB_SEARCH_PATH}) find_library(X11_xcb_randr_LIB xcb-randr ${X11_LIB_SEARCH_PATH}) + find_library(X11_xcb_shape_LIB xcb-shape ${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_xrm_LIB xcb-xrm ${X11_LIB_SEARCH_PATH}) find_library(X11_xcb_xtest_LIB xcb-xtest ${X11_LIB_SEARCH_PATH}) find_library(X11_xcb_keysyms_LIB xcb-keysyms ${X11_LIB_SEARCH_PATH}) find_library(X11_xcb_xkb_LIB xcb-xkb ${X11_LIB_SEARCH_PATH}) @@ -289,6 +301,10 @@ if (UNIX) set(X11_X11_xcb_FOUND TRUE) endif () + if (X11_xcb_cursor_LIB AND X11_xcb_cursor_INCLUDE_PATH) + set(X11_xcb_cursor_FOUND TRUE) + endif () + if (X11_xcb_icccm_LIB AND X11_xcb_icccm_INCLUDE_PATH) set(X11_xcb_icccm_FOUND TRUE) endif () @@ -297,6 +313,10 @@ if (UNIX) set(X11_xcb_randr_FOUND TRUE) endif () + if (X11_xcb_shape_LIB AND X11_xcb_shape_INCLUDE_PATH) + set(X11_xcb_shape_FOUND TRUE) + endif () + if (X11_xcb_util_LIB AND X11_xcb_util_INCLUDE_PATH) set(X11_xcb_util_FOUND TRUE) endif () @@ -305,6 +325,10 @@ if (UNIX) set(X11_xcb_xfixes_FOUND TRUE) endif () + if (X11_xcb_xrm_LIB AND X11_xcb_xrm_INCLUDE_PATH) + set(X11_xcb_xrm_FOUND TRUE) + endif () + if (X11_xcb_xtest_LIB) set(X11_xcb_xtest_FOUND TRUE) endif () @@ -617,6 +641,13 @@ if (UNIX) INTERFACE_LINK_LIBRARIES "X11::xcb;X11::X11") endif () + if (X11_xcb_cursor_FOUND AND NOT TARGET X11::xcb_cursor) + add_library(X11::xcb_cursor UNKNOWN IMPORTED) + set_target_properties(X11::xcb_cursor PROPERTIES + IMPORTED_LOCATION "${X11_xcb_cursor_LIB}" + INTERFACE_LINK_LIBRARIES "X11::xcb") + endif () + if (X11_xcb_icccm_FOUND AND NOT TARGET X11::xcb_icccm) add_library(X11::xcb_icccm UNKNOWN IMPORTED) set_target_properties(X11::xcb_icccm PROPERTIES @@ -631,6 +662,13 @@ if (UNIX) INTERFACE_LINK_LIBRARIES "X11::xcb") endif () + if (X11_xcb_shape_FOUND AND NOT TARGET X11::xcb_shape) + add_library(X11::xcb_shape UNKNOWN IMPORTED) + set_target_properties(X11::xcb_shape PROPERTIES + IMPORTED_LOCATION "${X11_xcb_shape_LIB}" + 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 @@ -645,6 +683,13 @@ if (UNIX) INTERFACE_LINK_LIBRARIES "X11::xcb") endif () + if (X11_xcb_xrm_FOUND AND NOT TARGET X11::xcb_xrm) + add_library(X11::xcb_xrm UNKNOWN IMPORTED) + set_target_properties(X11::xcb_xrm PROPERTIES + IMPORTED_LOCATION "${X11_xcb_xrm_LIB}" + INTERFACE_LINK_LIBRARIES "X11::xcb") + endif () + if (X11_xcb_xtest_FOUND AND NOT TARGET X11::xcb_xtest) add_library(X11::xcb_xtest UNKNOWN IMPORTED) set_target_properties(X11::xcb_xtest PROPERTIES @@ -873,14 +918,20 @@ if (UNIX) X11_Xau_INCLUDE_PATH X11_xcb_LIB X11_xcb_INCLUDE_PATH + X11_xcb_cursor_LIB + X11_xcb_cursor_INCLUDE_PATH X11_xcb_icccm_LIB X11_xcb_icccm_INCLUDE_PATH X11_xcb_randr_LIB X11_xcb_randr_INCLUDE_PATH + X11_xcb_shape_LIB + X11_xcb_shape_INCLUDE_PATH X11_xcb_util_LIB X11_xcb_util_INCLUDE_PATH X11_xcb_xfixes_LIB X11_xcb_xfixes_INCLUDE_PATH + X11_xcb_xrm_LIB + X11_xcb_xrm_INCLUDE_PATH X11_xcb_xtest_LIB X11_xcb_xtest_INCLUDE_PATH X11_xcb_keysyms_LIB diff --git a/Tests/FindX11/Test/CMakeLists.txt b/Tests/FindX11/Test/CMakeLists.txt index 18a73a3..e39ffb1 100644 --- a/Tests/FindX11/Test/CMakeLists.txt +++ b/Tests/FindX11/Test/CMakeLists.txt @@ -32,10 +32,13 @@ test_x11_component(x11_components Xau) 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_cursor) test_x11_component(x11_components xcb_icccm) test_x11_component(x11_components xcb_randr) +test_x11_component(x11_components xcb_shape) test_x11_component(x11_components xcb_util) test_x11_component(x11_components xcb_xfixes) +test_x11_component(x11_components xcb_xrm) test_x11_component(x11_components xcb_xtest) test_x11_component(x11_components xcb_keysyms) test_x11_component(x11_components xcb_xkb) @@ -76,10 +79,13 @@ foreach(lib Xaw xcb X11_xcb + xcb_cursor xcb_icccm xcb_randr + xcb_shape xcb_util xcb_xfixes + xcb_xrm Xcomposite Xdamage Xdmcp diff --git a/Tests/FindX11/Test/main.c b/Tests/FindX11/Test/main.c index c20257f..5240de0 100644 --- a/Tests/FindX11/Test/main.c +++ b/Tests/FindX11/Test/main.c @@ -336,6 +336,22 @@ static void test_xcb(void) xcb_disconnect(connection); } +# ifdef HAVE_xcb_cursor +# include <xcb/xcb_cursor.h> + +static void test_xcb_cursor(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_screen_t* screen = xcb_aux_get_screen(conn, screen_nbr); + xcb_cursor_context_t* ctx; + xcb_cursor_context_new(connection, screen, &ctx); + xcb_cursor_context_free(ctx); + xcb_disconnect(connection); +} + +# endif + # ifdef HAVE_xcb_randr # include <xcb/randr.h> @@ -350,6 +366,20 @@ static void test_xcb_randr(void) # endif +# ifdef HAVE_xcb_shape +# include <xcb/shape.h> + +static void test_xcb_shape(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_shape_query_version_cookie_t cookie = + xcb_shape_query_version(connection); + xcb_disconnect(connection); +} + +# endif + # ifdef HAVE_xcb_util # include <xcb/xcb_aux.h> @@ -376,6 +406,20 @@ static void test_xcb_xfixes(void) # endif +# ifdef HAVE_xcb_xrm +# include <xcb/xcb_xrm.h> + +static void test_xcb_xrm(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_xrm_database_t* db = xcb_xrm_database_from_default(connection); + xcb_xrm_database_free(db); + xcb_disconnect(connection); +} + +# endif + # ifdef HAVE_xcb_xtest # include <xcb/xtest.h> @@ -496,15 +540,24 @@ int main(int argc, char* argv[]) #ifdef HAVE_xcb test_xcb, #endif +#ifdef HAVE_xcb_cursor + test_xcb_cursor, +#endif #ifdef HAVE_xcb_randr test_xcb_randr, #endif +#ifdef HAVE_xcb_shape + test_xcb_shape, +#endif #ifdef HAVE_xcb_util test_xcb_util, #endif #ifdef HAVE_xcb_xfixes test_xcb_xfixes, #endif +#ifdef HAVE_xcb_xrm + test_xcb_xrm, +#endif NULL, }; |