Move the XTest check to cmake

Where the ifdef was checked, the alternative was a compiler error. We can
shortcut that process and just fail in cmake where the header is not found.
This commit is contained in:
Peter Hutterer 2020-12-09 14:29:33 +10:00
parent 38390f9b88
commit f3eb89121d
5 changed files with 7 additions and 18 deletions

View File

@ -200,6 +200,10 @@ if (UNIX)
set (HAVE_DPMS_PROTOTYPES 1) set (HAVE_DPMS_PROTOTYPES 1)
endif() endif()
if (NOT HAVE_X11_EXTENSIONS_XTEST_H)
message (FATAL_ERROR "Missing header: X11/extensions/XTest.h")
endif()
if (NOT HAVE_X11_XKBLIB_H) if (NOT HAVE_X11_XKBLIB_H)
message (FATAL_ERROR "Missing header: " ${XKBlib}) message (FATAL_ERROR "Missing header: " ${XKBlib})
endif() endif()

View File

@ -115,9 +115,6 @@
/* Define to 1 if you have the <X11/extensions/XKBstr.h> header file. */ /* Define to 1 if you have the <X11/extensions/XKBstr.h> header file. */
#cmakedefine HAVE_X11_EXTENSIONS_XKBSTR_H ${HAVE_X11_EXTENSIONS_XKBSTR_H} #cmakedefine HAVE_X11_EXTENSIONS_XKBSTR_H ${HAVE_X11_EXTENSIONS_XKBSTR_H}
/* Define to 1 if you have the <X11/extensions/XTest.h> header file. */
#cmakedefine HAVE_X11_EXTENSIONS_XTEST_H ${HAVE_X11_EXTENSIONS_XTEST_H}
/* Define to 1 if you have the <X11/XKBlib.h> header file. */ /* Define to 1 if you have the <X11/XKBlib.h> header file. */
#cmakedefine HAVE_X11_XKBLIB_H ${HAVE_X11_XKBLIB_H} #cmakedefine HAVE_X11_XKBLIB_H ${HAVE_X11_XKBLIB_H}

View File

@ -13,11 +13,7 @@
# include <X11/extensions/dpms.h> # include <X11/extensions/dpms.h>
} }
#endif #endif
#if HAVE_X11_EXTENSIONS_XTEST_H #include <X11/extensions/XTest.h>
# include <X11/extensions/XTest.h>
#else
# error The XTest extension is required to build barrier
#endif
#if HAVE_X11_EXTENSIONS_XINERAMA_H #if HAVE_X11_EXTENSIONS_XINERAMA_H
// Xinerama.h may lack extern "C" for inclusion by C++ // Xinerama.h may lack extern "C" for inclusion by C++
extern "C" { extern "C" {

View File

@ -24,11 +24,7 @@
#include "XWindowsImpl.h" #include "XWindowsImpl.h"
#include <X11/Xlib.h> #include <X11/Xlib.h>
#if HAVE_X11_EXTENSIONS_XTEST_H #include <X11/extensions/XTest.h>
# include <X11/extensions/XTest.h>
#else
# error The XTest extension is required to build barrier
#endif
#if HAVE_XKB_EXTENSION #if HAVE_XKB_EXTENSION
# include <X11/extensions/XKBstr.h> # include <X11/extensions/XKBstr.h>
#endif #endif

View File

@ -26,11 +26,7 @@
#include "base/TMethodEventJob.h" #include "base/TMethodEventJob.h"
#include <X11/Xatom.h> #include <X11/Xatom.h>
#if HAVE_X11_EXTENSIONS_XTEST_H #include <X11/extensions/XTest.h>
# include <X11/extensions/XTest.h>
#else
# error The XTest extension is required to build barrier
#endif
#if HAVE_X11_EXTENSIONS_DPMS_H #if HAVE_X11_EXTENSIONS_DPMS_H
extern "C" { extern "C" {
# include <X11/Xmd.h> # include <X11/Xmd.h>