From c70db0cabf7e32fd13b4bd2d3f59dfbd66aa1d39 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sun, 24 Jun 2018 15:12:18 -0400 Subject: [PATCH] cmake: Look in popular places for X11 headers, export this info properly. Fixes CMake not being able to find X11 on FreeBSD (which generally has the headers in /usr/local/include/X11). List of other popular places borrowed from CMake's FindX11 module. This worked on the configure script because of magic in the AC_PATH_X macro. Fixes Bugzilla #4815. --- cmake/sdlchecks.cmake | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/cmake/sdlchecks.cmake b/cmake/sdlchecks.cmake index b822c7a56..b62c20fd9 100644 --- a/cmake/sdlchecks.cmake +++ b/cmake/sdlchecks.cmake @@ -381,9 +381,21 @@ macro(CheckX11) FindLibraryAndSONAME("${_LIB}") endforeach() - find_path(X_INCLUDEDIR X11/Xlib.h) + find_path(X_INCLUDEDIR X11/Xlib.h + /usr/pkg/xorg/include + /usr/X11R6/include + /usr/X11R7/include + /usr/local/include/X11 + /usr/include/X11 + /usr/openwin/include + /usr/openwin/share/include + /opt/graphics/OpenGL/include + /opt/X11/include + ) + if(X_INCLUDEDIR) - set(X_CFLAGS "-I${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) @@ -420,7 +432,7 @@ macro(CheckX11) endif() if(NOT HAVE_SHMAT) add_definitions(-DNO_SHARED_MEMORY) - set(X_CFLAGS "${X_CFLAGS} -DNO_SHARED_MEMORY") + list(APPEND EXTRA_CFLAGS "-DNO_SHARED_MEMORY") endif() endif() @@ -439,8 +451,6 @@ macro(CheckX11) endif() endif() - set(SDL_CFLAGS "${SDL_CFLAGS} ${X_CFLAGS}") - set(CMAKE_REQUIRED_LIBRARIES ${X11_LIB} ${X11_LIB}) check_c_source_compiles(" #include