summaryrefslogtreecommitdiff
path: root/Tests
diff options
context:
space:
mode:
authorMoses Miller <Majora320@gmail.com>2023-03-28 15:38:25 -0700
committerBrad King <brad.king@kitware.com>2023-04-25 10:05:59 -0400
commit7a2b02e00036c428b7baeaf0579d716b1f63773b (patch)
treebd926b451b5f0d9bea6bd3fa9cba27ceafecf70a /Tests
parent9d21d115c62ca528293c0a412f965e6eccdaabb8 (diff)
downloadcmake-7a2b02e00036c428b7baeaf0579d716b1f63773b.tar.gz
FindX11: Fix existing tests
Diffstat (limited to 'Tests')
-rw-r--r--Tests/FindX11/Test/CMakeLists.txt10
-rw-r--r--Tests/FindX11/Test/main.c42
2 files changed, 31 insertions, 21 deletions
diff --git a/Tests/FindX11/Test/CMakeLists.txt b/Tests/FindX11/Test/CMakeLists.txt
index 3312f6f772..afc10c9a5d 100644
--- a/Tests/FindX11/Test/CMakeLists.txt
+++ b/Tests/FindX11/Test/CMakeLists.txt
@@ -11,8 +11,14 @@ function (test_x11_component have_var component)
endif ()
add_executable(test_tgt_${component} main.c)
- target_link_libraries(test_tgt_${component} PRIVATE X11::${component})
- target_compile_definitions(test_tgt_${component} PRIVATE HAVE_X11_${component})
+
+ if (component MATCHES xcb)
+ target_link_libraries(test_tgt_${component} PRIVATE X11::${component} X11::xcb)
+ target_compile_definitions(test_tgt_${component} PRIVATE HAVE_X11_${component} HAVE_X11_xcb)
+ else()
+ target_link_libraries(test_tgt_${component} PRIVATE X11::${component})
+ target_compile_definitions(test_tgt_${component} PRIVATE HAVE_X11_${component})
+ endif()
add_test(NAME test_tgt_${component} COMMAND test_tgt_${component})
# Add to the list of components to test for the parent.
diff --git a/Tests/FindX11/Test/main.c b/Tests/FindX11/Test/main.c
index 5240de0f68..359470d861 100644
--- a/Tests/FindX11/Test/main.c
+++ b/Tests/FindX11/Test/main.c
@@ -326,7 +326,7 @@ static void test_Xaw(void)
#endif
-#ifdef HAVE_xcb
+#ifdef HAVE_X11_xcb
# include <xcb/xcb.h>
static void test_xcb(void)
@@ -336,23 +336,24 @@ static void test_xcb(void)
xcb_disconnect(connection);
}
-# ifdef HAVE_xcb_cursor
+# ifdef HAVE_X11_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_screen_iterator_t screens =
+ xcb_setup_roots_iterator(xcb_get_setup(connection));
xcb_cursor_context_t* ctx;
- xcb_cursor_context_new(connection, screen, &ctx);
+ xcb_cursor_context_new(connection, screens.data, &ctx);
xcb_cursor_context_free(ctx);
xcb_disconnect(connection);
}
# endif
-# ifdef HAVE_xcb_randr
+# ifdef HAVE_X11_xcb_randr
# include <xcb/randr.h>
static void test_xcb_randr(void)
@@ -366,7 +367,7 @@ static void test_xcb_randr(void)
# endif
-# ifdef HAVE_xcb_shape
+# ifdef HAVE_X11_xcb_shape
# include <xcb/shape.h>
static void test_xcb_shape(void)
@@ -380,7 +381,9 @@ static void test_xcb_shape(void)
# endif
-# ifdef HAVE_xcb_util
+#
+
+# ifdef HAVE_X11_xcb_util
# include <xcb/xcb_aux.h>
static void test_xcb_util(void)
@@ -393,8 +396,8 @@ static void test_xcb_util(void)
# endif
-# ifdef HAVE_xcb_xfixes
-# include <xcb/xcb_xfixes.h>
+# ifdef HAVE_X11_xcb_xfixes
+# include <xcb/xfixes.h>
static void test_xcb_xfixes(void)
{
@@ -406,7 +409,7 @@ static void test_xcb_xfixes(void)
# endif
-# ifdef HAVE_xcb_xrm
+# ifdef HAVE_X11_xcb_xrm
# include <xcb/xcb_xrm.h>
static void test_xcb_xrm(void)
@@ -420,7 +423,7 @@ static void test_xcb_xrm(void)
# endif
-# ifdef HAVE_xcb_xtest
+# ifdef HAVE_X11_xcb_xtest
# include <xcb/xtest.h>
static void test_xcb_xtest(void)
@@ -433,7 +436,7 @@ static void test_xcb_xtest(void)
# endif
-# ifdef HAVE_xcb_keysyms
+# ifdef HAVE_X11_xcb_keysyms
# include <xcb/xcb_keysyms.h>
static void test_xcb_keysyms(void)
@@ -537,25 +540,25 @@ int main(int argc, char* argv[])
#ifdef HAVE_X11_Xaw
test_Xaw,
#endif
-#ifdef HAVE_xcb
+#ifdef HAVE_X11_xcb
test_xcb,
#endif
-#ifdef HAVE_xcb_cursor
+#ifdef HAVE_X11_xcb_cursor
test_xcb_cursor,
#endif
-#ifdef HAVE_xcb_randr
+#ifdef HAVE_X11_xcb_randr
test_xcb_randr,
#endif
-#ifdef HAVE_xcb_shape
+#ifdef HAVE_X11_xcb_shape
test_xcb_shape,
#endif
-#ifdef HAVE_xcb_util
+#ifdef HAVE_X11_xcb_util
test_xcb_util,
#endif
-#ifdef HAVE_xcb_xfixes
+#ifdef HAVE_X11_xcb_xfixes
test_xcb_xfixes,
#endif
-#ifdef HAVE_xcb_xrm
+#ifdef HAVE_X11_xcb_xrm
test_xcb_xrm,
#endif
@@ -567,5 +570,6 @@ int main(int argc, char* argv[])
// always 1 in the test harness which always returns the sentinel at the end
// of the array. The array logic is there to ensure that the contents of
// `fptrs` is not optimized out.
+#pragma GCC diagnostic ignored "-Wpointer-to-int-cast"
return (int)fptrs[(sizeof(fptrs) / sizeof(*fptrs)) - argc];
}