CMake/Tests/X11/X11.c

38 lines
431 B
C
Raw Normal View History

2002-10-29 23:54:40 +03:00
#ifdef CMAKE_HAS_X
2002-10-29 23:46:38 +03:00
#include <X11/Xlib.h>
#include <X11/Xutil.h>
2002-11-05 15:06:00 +03:00
#include <stdlib.h>
2002-10-29 23:46:38 +03:00
2002-11-05 15:06:00 +03:00
int main()
2002-10-29 23:46:38 +03:00
{
Display *mydisplay;
2002-11-04 19:54:30 +03:00
char* display = ":0";
2002-10-29 23:46:38 +03:00
2002-11-04 19:54:30 +03:00
if ( getenv("DISPLAY") )
{
display = getenv("DISPLAY");
}
mydisplay=XOpenDisplay(display);
if ( mydisplay )
{
XCloseDisplay(mydisplay);
}
2002-11-05 15:06:00 +03:00
return 0;
2002-10-29 23:46:38 +03:00
}
2002-10-29 23:54:40 +03:00
#else
2002-10-29 23:58:35 +03:00
#include "stdio.h"
2002-10-29 23:54:40 +03:00
int main()
{
2002-10-29 23:58:35 +03:00
printf("No X on this computer\n");
2002-10-29 23:54:40 +03:00
return 0;
}
#endif