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 b35dc849ee)
This commit is contained in:
Bernhard Miklautz 2014-12-12 17:43:14 +01:00
parent 598d30f8b8
commit 0027350ff0
13 changed files with 35 additions and 0 deletions

View File

@ -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)

View File

@ -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"
)

View File

@ -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"
)

View File

@ -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"
)

View File

@ -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"
)

View File

@ -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"
)

View File

@ -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"
)

View File

@ -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"
)

View File

@ -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"
)

View File

@ -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)

View File

@ -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"
)

View File

@ -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)

View File

@ -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"
)