From 0027350ff027710ad7dedf3f66e6a66827965143 Mon Sep 17 00:00:00 2001 From: Bernhard Miklautz Date: Fri, 12 Dec 2014 17:43:14 +0100 Subject: [PATCH] build: improve X11 detection on OS X /usr/X11R6 doesn't exist on OS X per default (anymore). Therefore add PATHS to all X11 detection modules pointing to the Xquarz installation directory in /opt/X11. For FindX11 it was also necessary to ensure that the frameworks are searched as last (after PATHS) otherwise it could happen that X11 headers of a framework (e.g. Tk.framework) were used. (cherry picked from commit b35dc849eeca3458527490ef050217c99d1e100f) --- cmake/FindX11.cmake | 11 +++++++++++ cmake/FindXKBFile.cmake | 2 ++ cmake/FindXRandR.cmake | 2 ++ cmake/FindXShm.cmake | 2 ++ cmake/FindXTest.cmake | 2 ++ cmake/FindXcursor.cmake | 2 ++ cmake/FindXdamage.cmake | 2 ++ cmake/FindXext.cmake | 2 ++ cmake/FindXfixes.cmake | 2 ++ cmake/FindXi.cmake | 2 ++ cmake/FindXinerama.cmake | 2 ++ cmake/FindXrender.cmake | 2 ++ cmake/FindXv.cmake | 2 ++ 13 files changed, 35 insertions(+) diff --git a/cmake/FindX11.cmake b/cmake/FindX11.cmake index 594b2c022..a2d8954db 100644 --- a/cmake/FindX11.cmake +++ b/cmake/FindX11.cmake @@ -28,15 +28,26 @@ # limitations under the License. #============================================================================= +if (APPLE) + set(CMAKE_FIND_FRAMEWORK_OLD ${CMAKE_FIND_FRAMEWORK}) + set(CMAKE_FIND_FRAMEWORK LAST) +endif () + find_path(X11_INCLUDE_DIR NAMES X11/Xlib.h PATH_SUFFIXES X11 + PATHS /opt/X11/include DOC "The X11 include directory" ) find_library(X11_LIBRARY NAMES X11 + PATHS /opt/X11/lib DOC "The X11 library" ) +if(APPLE) + set(CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK_OLD}) +endif() + include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(X11 DEFAULT_MSG X11_LIBRARY X11_INCLUDE_DIR) diff --git a/cmake/FindXKBFile.cmake b/cmake/FindXKBFile.cmake index e47ff997a..bfb6c4ca0 100644 --- a/cmake/FindXKBFile.cmake +++ b/cmake/FindXKBFile.cmake @@ -30,10 +30,12 @@ find_path(XKBFILE_INCLUDE_DIR NAMES X11/extensions/XKBfile.h PATH_SUFFIXES X11/extensions + PATHS /opt/X11/include DOC "The XKBFile include directory" ) find_library(XKBFILE_LIBRARY NAMES xkbfile + PATHS /opt/X11/lib DOC "The XKBFile library" ) diff --git a/cmake/FindXRandR.cmake b/cmake/FindXRandR.cmake index e9e38c379..7b0ec7185 100644 --- a/cmake/FindXRandR.cmake +++ b/cmake/FindXRandR.cmake @@ -28,10 +28,12 @@ find_path(XRANDR_INCLUDE_DIR NAMES X11/extensions/Xrandr.h PATH_SUFFIXES X11/extensions + PATHS /opt/X11/include DOC "The XRANDR include directory" ) find_library(XRANDR_LIBRARY NAMES Xrandr + PATHS /opt/X11/lib DOC "The XRANDR library" ) diff --git a/cmake/FindXShm.cmake b/cmake/FindXShm.cmake index cc4b6d5c0..7b0796ebd 100644 --- a/cmake/FindXShm.cmake +++ b/cmake/FindXShm.cmake @@ -30,10 +30,12 @@ find_path(XSHM_INCLUDE_DIR NAMES X11/extensions/XShm.h PATH_SUFFIXES X11/extensions + PATHS /opt/X11/include DOC "The XShm include directory" ) find_library(XSHM_LIBRARY NAMES Xext + PATHS /opt/X11/lib DOC "The XShm library" ) diff --git a/cmake/FindXTest.cmake b/cmake/FindXTest.cmake index f4a8561e6..8fb21f682 100644 --- a/cmake/FindXTest.cmake +++ b/cmake/FindXTest.cmake @@ -30,10 +30,12 @@ find_path(XTEST_INCLUDE_DIR NAMES X11/extensions/XTest.h PATH_SUFFIXES X11/extensions + PATHS /opt/X11/include DOC "The XTest include directory" ) find_library(XTEST_LIBRARY NAMES Xtst + PATHS /opt/X11/lib DOC "The XTest library" ) diff --git a/cmake/FindXcursor.cmake b/cmake/FindXcursor.cmake index cc22bbd39..a333ecd4e 100644 --- a/cmake/FindXcursor.cmake +++ b/cmake/FindXcursor.cmake @@ -30,10 +30,12 @@ find_path(XCURSOR_INCLUDE_DIR NAMES X11/Xcursor/Xcursor.h PATH_SUFFIXES X11/Xcursor + PATHS /opt/X11/include DOC "The Xcursor include directory" ) find_library(XCURSOR_LIBRARY NAMES Xcursor + PATHS /opt/X11/lib DOC "The Xcursor library" ) diff --git a/cmake/FindXdamage.cmake b/cmake/FindXdamage.cmake index a3ddf28a2..16f8f6473 100644 --- a/cmake/FindXdamage.cmake +++ b/cmake/FindXdamage.cmake @@ -30,10 +30,12 @@ find_path(XDAMAGE_INCLUDE_DIR NAMES X11/extensions/Xdamage.h PATH_SUFFIXES X11/extensions + PATHS /opt/X11/include DOC "The Xdamage include directory" ) find_library(XDAMAGE_LIBRARY NAMES Xdamage + PATHS /opt/X11/lib DOC "The Xdamage library" ) diff --git a/cmake/FindXext.cmake b/cmake/FindXext.cmake index 8cfe552f8..bb054003f 100644 --- a/cmake/FindXext.cmake +++ b/cmake/FindXext.cmake @@ -30,10 +30,12 @@ find_path(XEXT_INCLUDE_DIR NAMES X11/extensions/Xext.h PATH_SUFFIXES X11/extensions + PATHS /opt/X11/include DOC "The Xext include directory" ) find_library(XEXT_LIBRARY NAMES Xext + PATHS /opt/X11/lib DOC "The Xext library" ) diff --git a/cmake/FindXfixes.cmake b/cmake/FindXfixes.cmake index a7e633ea2..ca3e5119b 100644 --- a/cmake/FindXfixes.cmake +++ b/cmake/FindXfixes.cmake @@ -30,10 +30,12 @@ find_path(XFIXES_INCLUDE_DIR NAMES X11/extensions/Xfixes.h PATH_SUFFIXES X11/extensions + PATHS /opt/X11/include DOC "The Xfixes include directory" ) find_library(XFIXES_LIBRARY NAMES Xfixes + PATHS /opt/X11/lib DOC "The Xfixes library" ) diff --git a/cmake/FindXi.cmake b/cmake/FindXi.cmake index d01f4002b..e240b4bb5 100644 --- a/cmake/FindXi.cmake +++ b/cmake/FindXi.cmake @@ -31,9 +31,11 @@ include(CheckSymbolExists) find_path(XI_INCLUDE_DIR NAMES X11/extensions/XInput2.h + PATHS /opt/X11/include DOC "The Xi include directory") find_library(XI_LIBRARY NAMES Xi + PATHS /opt/X11/lib DOC "The Xi library") include(FindPackageHandleStandardArgs) diff --git a/cmake/FindXinerama.cmake b/cmake/FindXinerama.cmake index ff9f4d1f2..8863d8c7b 100644 --- a/cmake/FindXinerama.cmake +++ b/cmake/FindXinerama.cmake @@ -29,11 +29,13 @@ #============================================================================= find_path(XINERAMA_INCLUDE_DIR NAMES X11/extensions/Xinerama.h + PATHS /opt/X11/include PATH_SUFFIXES X11/extensions DOC "The Xinerama include directory" ) find_library(XINERAMA_LIBRARY NAMES Xinerama + PATHS /opt/X11/lib DOC "The Xinerama library" ) diff --git a/cmake/FindXrender.cmake b/cmake/FindXrender.cmake index 461217578..4d382319b 100644 --- a/cmake/FindXrender.cmake +++ b/cmake/FindXrender.cmake @@ -27,9 +27,11 @@ #============================================================================= find_path(XRENDER_INCLUDE_DIR NAMES X11/extensions/Xrender.h + PATHS /opt/X11/include DOC "The Xrender include directory") find_library(XRENDER_LIBRARY NAMES Xrender + PATHS /opt/X11/lib DOC "The Xrender library") include(FindPackageHandleStandardArgs) diff --git a/cmake/FindXv.cmake b/cmake/FindXv.cmake index 0ba833d8a..ded749698 100644 --- a/cmake/FindXv.cmake +++ b/cmake/FindXv.cmake @@ -29,10 +29,12 @@ #============================================================================= find_path(XV_INCLUDE_DIR NAMES X11/extensions/Xv.h + PATHS /opt/X11/include DOC "The Xv include directory" ) find_library(XV_LIBRARY NAMES Xv + PATHS /opt/X11/lib DOC "The Xv library" )