From e5698d13940c088f2260fbeefcd1dc3767251385 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 21 Jul 2022 18:38:12 +0200 Subject: [PATCH] cmake: allow cmake re-configuration after installation of x11 library check_include_path is not meant to be used to check for presence of a library. This is because a BOOL is cached. Avoid this caching by using find_file. `find_file` caches a patch instead of a bool and will always run when the result failed. --- cmake/sdlchecks.cmake | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/cmake/sdlchecks.cmake b/cmake/sdlchecks.cmake index b0a1d79b1..07d472a7e 100644 --- a/cmake/sdlchecks.cmake +++ b/cmake/sdlchecks.cmake @@ -422,7 +422,10 @@ macro(CheckX11) FindLibraryAndSONAME("${_LIB}") endforeach() - find_path(X_INCLUDEDIR X11/Xlib.h + set(X11_dirs) + find_path(X_INCLUDEDIR + NAMES X11/Xlib.h + PATHS /usr/pkg/xorg/include /usr/X11R6/include /usr/X11R7/include @@ -436,18 +439,17 @@ macro(CheckX11) if(X_INCLUDEDIR) list(APPEND EXTRA_CFLAGS "-I${X_INCLUDEDIR}") - list(APPEND CMAKE_REQUIRED_INCLUDES "${X_INCLUDEDIR}") endif() - check_include_file(X11/Xcursor/Xcursor.h HAVE_XCURSOR_H) - check_include_file(X11/extensions/XInput2.h HAVE_XINPUT2_H) - check_include_file(X11/extensions/Xrandr.h HAVE_XRANDR_H) - check_include_file(X11/extensions/Xfixes.h HAVE_XFIXES_H_) - check_include_file(X11/extensions/Xrender.h HAVE_XRENDER_H) - check_include_file(X11/extensions/scrnsaver.h HAVE_XSS_H) - check_include_file(X11/extensions/shape.h HAVE_XSHAPE_H) - check_include_files("X11/Xlib.h;X11/extensions/Xdbe.h" HAVE_XDBE_H) - check_include_files("X11/Xlib.h;X11/Xproto.h;X11/extensions/Xext.h" HAVE_XEXT_H) + find_file(HAVE_XCURSOR_H NAMES "X11/Xcursor/Xcursor.h" HINTS "${X_INCLUDEDIR}") + find_file(HAVE_XINPUT2_H NAMES "X11/extensions/XInput2.h" HINTS "${X_INCLUDEDIR}") + find_file(HAVE_XRANDR_H NAMES "X11/extensions/Xrandr.h" HINTS "${X_INCLUDEDIR}") + find_file(HAVE_XFIXES_H_ NAMES "X11/extensions/Xfixes.h" HINTS "${X_INCLUDEDIR}") + find_file(HAVE_XRENDER_H NAMES "X11/extensions/Xrender.h" HINTS "${X_INCLUDEDIR}") + find_file(HAVE_XSS_H NAMES "X11/extensions/scrnsaver.h" HINTS "${X_INCLUDEDIR}") + find_file(HAVE_XSHAPE_H NAMES "X11/extensions/shape.h" HINTS "${X_INCLUDEDIR}") + find_file(HAVE_XDBE_H NAMES "X11/extensions/Xdbe.h" HINTS "${X_INCLUDEDIR}") + find_file(HAVE_XEXT_H NAMES "X11/extensions/Xext.h" HINTS "${X_INCLUDEDIR}") if(X11_LIB) if(NOT HAVE_XEXT_H)