[brlcad-commits] SF.net SVN: brlcad:[49106] brlcad/trunk
Open Source Solid Modeling CAD
Brought to you by:
brlcad
From: <sta...@us...> - 2012-01-26 18:42:33
|
Revision: 49106 http://brlcad.svn.sourceforge.net/brlcad/?rev=49106&view=rev Author: starseeker Date: 2012-01-26 18:42:19 +0000 (Thu, 26 Jan 2012) Log Message: ----------- Rework FindX11.cmake to be aware if results are coming back from multiple directories, and report that fact. Too complicated to have it sort out multiple X11 installations - this will at least help the user's awareness that there might be a problem. Modified Paths: -------------- brlcad/trunk/TODO brlcad/trunk/misc/CMake/FindX11.cmake brlcad/trunk/src/other/incrTcl/itk/CMake/FindX11.cmake brlcad/trunk/src/other/tk/CMake/FindX11.cmake brlcad/trunk/src/other/tkhtml/CMake/FindX11.cmake brlcad/trunk/src/other/tkpng/CMake/FindX11.cmake brlcad/trunk/src/other/tktable/CMake/FindX11.cmake Modified: brlcad/trunk/TODO =================================================================== --- brlcad/trunk/TODO 2012-01-26 18:38:08 UTC (rev 49105) +++ brlcad/trunk/TODO 2012-01-26 18:42:19 UTC (rev 49106) @@ -43,18 +43,6 @@ * hook marching cubes into libged facetize -* fix osX link line to stop mixing X libs (causes segfault on GL stuff) - Assuming this is CMake - this will involve making FindX11 "smarter" - about ensuring that all of the various X11 libraries it finds share - a common directory structure. The problem appears to manifest when - both XQuartz (Apple's X11) and one of the third party packaging - systems' X11 (Fink, Macports, etc.) are installed simultaneously. - Probably the way to do this will be to find the "main" X11 library, - search for other libraries in that specific parent path to develop - a results set, and then do that again for any other "main" X11 - libraries. Will need some decision criteria if multiple valid - installs are found. - CY - * eliminate dbi_filepath (perhaps replace with dbi_filedir) as we shouldn't need to search. we were told where the database was. Modified: brlcad/trunk/misc/CMake/FindX11.cmake =================================================================== --- brlcad/trunk/misc/CMake/FindX11.cmake 2012-01-26 18:38:08 UTC (rev 49105) +++ brlcad/trunk/misc/CMake/FindX11.cmake 2012-01-26 18:42:19 UTC (rev 49106) @@ -130,12 +130,42 @@ # #============================================================================= +MACRO(X11_FIND_INCLUDE_PATH component header) + find_path(X11_${component}_INCLUDE_PATH ${header} ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) + set(X11_HDR_VARS ${X11_HDR_VARS} X11_${component}_INCLUDE_PATH) + if(X11_${component}_INCLUDE_PATH) + set(X11_HDR_PATHS ${X11_HDR_PATHS} ${X11_${component}_INCLUDE_PATH}) + list(REMOVE_DUPLICATES X11_HDR_PATHS) + endif(X11_${component}_INCLUDE_PATH) +ENDMACRO(X11_FIND_INCLUDE_PATH) + +MACRO(X11_FIND_LIB_PATH component libname) + find_library(X11_${component}_LIB ${libname} ${X11_LIB_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) + set(X11_LIB_VARS ${X11_LIB_VARS} X11_${component}_LIB) + if(X11_${component}_LIB) + get_filename_component(X11_${component}_DIR ${X11_${component}_LIB} PATH) + set(X11_LIB_PATHS ${X11_LIB_PATHS} ${X11_${component}_DIR}) + list(REMOVE_DUPLICATES X11_LIB_PATHS) + endif(X11_${component}_LIB) +ENDMACRO(X11_FIND_LIB_PATH) + if(UNIX) set(X11_FOUND 0) # X11 is never a framework and some header files may be # found in tcl on the mac set(CMAKE_FIND_FRAMEWORK_SAVE ${CMAKE_FIND_FRAMEWORK}) set(CMAKE_FIND_FRAMEWORK NEVER) + + + # See whether we're looking for 32 or 64 bit libraries + get_property(SEARCH_64BIT GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS) + if(SEARCH_64BIT) + set(64BIT_DIRS "/usr/lib64/X11;/usr/lib64;/usr/lib/x86_64-linux-gnu") + else(SEARCH_64BIT) + set(32BIT_DIRS "/usr/lib/X11;/usr/lib") + endif(SEARCH_64BIT) + + # Candidate directories for headers set(X11_INC_SEARCH_PATH /usr/X11/include /usr/include @@ -150,13 +180,7 @@ /opt/graphics/OpenGL/include ) - get_property(SEARCH_64BIT GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS) - if(SEARCH_64BIT) - set(64BIT_DIRS "/usr/lib64/X11;/usr/lib64;/usr/lib/x86_64-linux-gnu") - else(SEARCH_64BIT) - set(32BIT_DIRS "/usr/lib/X11;/usr/lib") - endif(SEARCH_64BIT) - + # Candidate directories for libraries. set(X11_LIB_SEARCH_PATH ${64BIT_DIRS} ${32BIT_DIRS} @@ -167,67 +191,70 @@ /usr/pkg/xorg/lib ) - find_path(X11_X11_INCLUDE_PATH X11/X.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - find_path(X11_Xlib_INCLUDE_PATH X11/Xlib.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) + # Just in case, clear our lists + set(X11_HDR_VARS) + set(X11_HDR_PATHS) + set(X11_LIB_VARS) + set(X11_LIB_PATHS) + + # Find primary X11 headers + X11_FIND_INCLUDE_PATH(X11 X11/X.h) + X11_FIND_INCLUDE_PATH(Xlib X11/Xlib.h) + # Look for other X11 includes; keep the list sorted by name of the cmake X11_<component>_INCLUDE_PATH + # variable (component doesn't need to match the include file name). + X11_FIND_INCLUDE_PATH(ICE X11/ICE/ICE.h) + X11_FIND_INCLUDE_PATH(Xaccessrules X11/extensions/XKBrules.h) + X11_FIND_INCLUDE_PATH(Xaccessstr X11/extensions/XKBstr.h) + X11_FIND_INCLUDE_PATH(Xau X11/Xauth.h) + X11_FIND_INCLUDE_PATH(Xcomposite X11/extensions/Xcomposite.h) + X11_FIND_INCLUDE_PATH(Xcursor X11/Xcursor/Xcursor.h) + X11_FIND_INCLUDE_PATH(Xdamage X11/extensions/Xdamage.h) + X11_FIND_INCLUDE_PATH(Xdmcp X11/Xdmcp.h) + X11_FIND_INCLUDE_PATH(dpms X11/extensions/dpms.h) + X11_FIND_INCLUDE_PATH(xf86misc X11/extensions/xf86misc.h) + X11_FIND_INCLUDE_PATH(xf86vmode X11/extensions/xf86vmode.h) + X11_FIND_INCLUDE_PATH(Xfixes X11/extensions/Xfixes.h) + X11_FIND_INCLUDE_PATH(Xft X11/Xft/Xft.h) + X11_FIND_INCLUDE_PATH(Xi X11/extensions/XInput.h) + X11_FIND_INCLUDE_PATH(Xinerama X11/extensions/Xinerama.h) + X11_FIND_INCLUDE_PATH(Xinput X11/extensions/XInput.h) + X11_FIND_INCLUDE_PATH(Xkb X11/extensions/XKB.h) + X11_FIND_INCLUDE_PATH(Xkblib X11/XKBlib.h) + X11_FIND_INCLUDE_PATH(Xpm X11/xpm.h) + X11_FIND_INCLUDE_PATH(XTest X11/extensions/XTest.h) + X11_FIND_INCLUDE_PATH(XShm X11/extensions/XShm.h) + X11_FIND_INCLUDE_PATH(Xrandr X11/extensions/Xrandr.h) + X11_FIND_INCLUDE_PATH(Xrender X11/extensions/Xrender.h) + X11_FIND_INCLUDE_PATH(Xscreensaver X11/extensions/scrnsaver.h) + X11_FIND_INCLUDE_PATH(Xshape X11/extensions/shape.h) + X11_FIND_INCLUDE_PATH(Xutil X11/Xutil.h) + X11_FIND_INCLUDE_PATH(Xt X11/Intrinsic.h) + X11_FIND_INCLUDE_PATH(Xv X11/extensions/Xvlib.h) + - # Look for includes; keep the list sorted by name of the cmake *_INCLUDE_PATH - # variable (which doesn't need to match the include file name). - - # Solaris lacks XKBrules.h, so we should skip kxkbd there. - find_path(X11_ICE_INCLUDE_PATH X11/ICE/ICE.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - find_path(X11_Xaccessrules_INCLUDE_PATH X11/extensions/XKBrules.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - find_path(X11_Xaccessstr_INCLUDE_PATH X11/extensions/XKBstr.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - find_path(X11_Xau_INCLUDE_PATH X11/Xauth.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - find_path(X11_Xcomposite_INCLUDE_PATH X11/extensions/Xcomposite.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - find_path(X11_Xcursor_INCLUDE_PATH X11/Xcursor/Xcursor.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - find_path(X11_Xdamage_INCLUDE_PATH X11/extensions/Xdamage.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - find_path(X11_Xdmcp_INCLUDE_PATH X11/Xdmcp.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - find_path(X11_dpms_INCLUDE_PATH X11/extensions/dpms.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - find_path(X11_xf86misc_INCLUDE_PATH X11/extensions/xf86misc.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - find_path(X11_xf86vmode_INCLUDE_PATH X11/extensions/xf86vmode.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - find_path(X11_Xfixes_INCLUDE_PATH X11/extensions/Xfixes.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - find_path(X11_Xft_INCLUDE_PATH X11/Xft/Xft.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - find_path(X11_Xi_INCLUDE_PATH X11/extensions/XInput.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - find_path(X11_Xinerama_INCLUDE_PATH X11/extensions/Xinerama.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - find_path(X11_Xinput_INCLUDE_PATH X11/extensions/XInput.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - find_path(X11_Xkb_INCLUDE_PATH X11/extensions/XKB.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - find_path(X11_Xkblib_INCLUDE_PATH X11/XKBlib.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - find_path(X11_Xpm_INCLUDE_PATH X11/xpm.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - find_path(X11_XTest_INCLUDE_PATH X11/extensions/XTest.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - find_path(X11_XShm_INCLUDE_PATH X11/extensions/XShm.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - find_path(X11_Xrandr_INCLUDE_PATH X11/extensions/Xrandr.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - find_path(X11_Xrender_INCLUDE_PATH X11/extensions/Xrender.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - find_path(X11_Xscreensaver_INCLUDE_PATH X11/extensions/scrnsaver.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - find_path(X11_Xshape_INCLUDE_PATH X11/extensions/shape.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - find_path(X11_Xutil_INCLUDE_PATH X11/Xutil.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - find_path(X11_Xt_INCLUDE_PATH X11/Intrinsic.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - find_path(X11_Xv_INCLUDE_PATH X11/extensions/Xvlib.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - - - find_library(X11_X11_LIB X11 ${X11_LIB_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - + # Find primary X11 library + X11_FIND_LIB_PATH(X11 X11) # Find additional X libraries. Keep list sorted by library name. - find_library(X11_ICE_LIB ICE ${X11_LIB_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - find_library(X11_SM_LIB SM ${X11_LIB_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - find_library(X11_Xau_LIB Xau ${X11_LIB_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - find_library(X11_Xcomposite_LIB Xcomposite ${X11_LIB_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - find_library(X11_Xcursor_LIB Xcursor ${X11_LIB_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - find_library(X11_Xdamage_LIB Xdamage ${X11_LIB_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - find_library(X11_Xdmcp_LIB Xdmcp ${X11_LIB_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - find_library(X11_Xext_LIB Xext ${X11_LIB_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - find_library(X11_Xfixes_LIB Xfixes ${X11_LIB_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - find_library(X11_Xft_LIB Xft ${X11_LIB_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - find_library(X11_Xi_LIB Xi ${X11_LIB_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - find_library(X11_Xinerama_LIB Xinerama ${X11_LIB_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - find_library(X11_Xinput_LIB Xi ${X11_LIB_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - find_library(X11_Xpm_LIB Xpm ${X11_LIB_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - find_library(X11_Xrandr_LIB Xrandr ${X11_LIB_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - find_library(X11_Xrender_LIB Xrender ${X11_LIB_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - find_library(X11_Xscreensaver_LIB Xss ${X11_LIB_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - find_library(X11_Xt_LIB Xt ${X11_LIB_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - find_library(X11_XTest_LIB Xtst ${X11_LIB_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - find_library(X11_Xv_LIB Xv ${X11_LIB_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - find_library(X11_Xxf86misc_LIB Xxf86misc ${X11_LIB_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) + X11_FIND_LIB_PATH(ICE ICE) + X11_FIND_LIB_PATH(SM SM) + X11_FIND_LIB_PATH(Xau Xau) + X11_FIND_LIB_PATH(Xcomposite Xcomposite) + X11_FIND_LIB_PATH(Xcursor Xcursor) + X11_FIND_LIB_PATH(Xdamage Xdamage) + X11_FIND_LIB_PATH(Xdmcp Xdmcp) + X11_FIND_LIB_PATH(Xext Xext) + X11_FIND_LIB_PATH(Xfixes Xfixes) + X11_FIND_LIB_PATH(Xft Xft) + X11_FIND_LIB_PATH(Xi Xi) + X11_FIND_LIB_PATH(Xinerama Xinerama) + X11_FIND_LIB_PATH(Xpm Xpm) + X11_FIND_LIB_PATH(Xrandr Xrandr) + X11_FIND_LIB_PATH(Xrender Xrender) + X11_FIND_LIB_PATH(Xscreensaver Xss) + X11_FIND_LIB_PATH(Xt Xt) + X11_FIND_LIB_PATH(XTest Xtst) + X11_FIND_LIB_PATH(Xv Xv) + X11_FIND_LIB_PATH(Xxf86misc Xxf86misc) set(X11_LIBRARY_DIR "") if(X11_X11_LIB) @@ -252,8 +279,10 @@ set(X11_Xshape_FOUND TRUE) set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xshape_INCLUDE_PATH}) endif(X11_Xshape_INCLUDE_PATH) + + # We'll need a variable containing all X11 libraries found + set(X11_LIBRARIES) # start with empty list - set(X11_LIBRARIES) # start with empty list if(X11_X11_LIB) set(X11_LIBRARIES ${X11_LIBRARIES} ${X11_X11_LIB}) endif(X11_X11_LIB) @@ -468,6 +497,46 @@ # Build the final list of libraries. set(X11_LIBRARIES ${X11_X_PRE_LIBS} ${X11_LIBRARIES} ${X11_X_EXTRA_LIBS}) + # Check whether we're pulling headers from multiple directoreis + list(LENGTH X11_HDR_PATHS HDR_PATH_CNT) + if("${HDR_PATH_CNT}" GREATER 1) + message("\nNote: FindX11 is returning headers found in multiple paths. The user may wish to verify that components are not being returned from multiple X11 installations.\n") + if(CMAKE_SEARCH_OSX_PATHS) + if(NOT "${CMAKE_SEARCH_OSX_PATHS}" STREQUAL "SYSTEM") + message("Note that CMAKE_SEARCH_OSX_PATHS is set to ${CMAKE_SEARCH_OSX_PATHS} - if ${CMAKE_SEARCH_OSX_PATHS} has an incomplete installation of X11, that may cause this issue - a possible workaround is to set CMAKE_SEARCH_OSX_PATHS to SYSTEM and not use ${CMAKE_SEARCH_OSX_PATHS}.\n") + endif(NOT "${CMAKE_SEARCH_OSX_PATHS}" STREQUAL "SYSTEM") + endif(CMAKE_SEARCH_OSX_PATHS) + foreach(pathitem ${X11_HDR_PATHS}) + message("Headers found in ${pathitem}:") + foreach(varitem ${X11_HDR_VARS}) + if("${${varitem}}" MATCHES "${pathitem}") + message(" ${varitem}:${${varitem}}") + endif("${${varitem}}" MATCHES "${pathitem}") + endforeach(varitem ${X11_HDR_PATHS}) + message(" ") + endforeach(pathitem ${X11_HDR_PATHS}) + endif("${HDR_PATH_CNT}" GREATER 1) + + list(LENGTH X11_LIB_PATHS LIB_PATH_CNT) + if("${LIB_PATH_CNT}" GREATER 1) + message("\nNote: FindX11 is returning libraries found in multiple paths. The user may wish to verify that components are not being returned from multiple X11 installations.\n") + if(CMAKE_SEARCH_OSX_PATHS) + if(NOT "${CMAKE_SEARCH_OSX_PATHS}" STREQUAL "SYSTEM") + message("Note that CMAKE_SEARCH_OSX_PATHS is set to ${CMAKE_SEARCH_OSX_PATHS} - if ${CMAKE_SEARCH_OSX_PATHS} has an incomplete installation of X11, that may cause this issue - a possible workaround is to set CMAKE_SEARCH_OSX_PATHS to SYSTEM and not use ${CMAKE_SEARCH_OSX_PATHS}.\n") + endif(NOT "${CMAKE_SEARCH_OSX_PATHS}" STREQUAL "SYSTEM") + endif(CMAKE_SEARCH_OSX_PATHS) + + foreach(pathitem ${X11_LIB_PATHS}) + message("Libraries found in ${pathitem}:") + foreach(varitem ${X11_LIB_VARS}) + if("${${varitem}}" MATCHES "${pathitem}") + message(" ${varitem}:${${varitem}}") + endif("${${varitem}}" MATCHES "${pathitem}") + endforeach(varitem ${X11_LIB_PATHS}) + message(" ") + endforeach(pathitem ${X11_LIB_PATHS}) + endif("${LIB_PATH_CNT}" GREATER 1) + include(FindPackageMessage) FIND_PACKAGE_MESSAGE(X11 "Found X11: ${X11_X11_LIB}" "[${X11_X11_LIB}][${X11_INCLUDE_DIR}]") Modified: brlcad/trunk/src/other/incrTcl/itk/CMake/FindX11.cmake =================================================================== --- brlcad/trunk/src/other/incrTcl/itk/CMake/FindX11.cmake 2012-01-26 18:38:08 UTC (rev 49105) +++ brlcad/trunk/src/other/incrTcl/itk/CMake/FindX11.cmake 2012-01-26 18:42:19 UTC (rev 49106) @@ -1,3 +1,38 @@ +# F I N D X 1 1 . C M A K E +# BRL-CAD +# +# Copyright (c) 2001-2012 United States Government as represented by +# the U.S. Army Research Laboratory. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# 3. The name of the author may not be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS +# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +### # - Find X11 installation # Try to find X11 on UNIX systems. The following values are defined # X11_FOUND - True if X11 is available @@ -38,24 +73,100 @@ #============================================================================= # Copyright 2001-2009 Kitware, Inc. -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# ------------------------------------------------------------------------------ +# +# The above copyright and license notice applies to distributions of +# CMake in source and binary form. Some source files contain additional +# notices of original copyright by their contributors; see each source +# for details. Third-party software packages supplied with CMake under +# compatible licenses provide their own copyright notices documented in +# corresponding subdirectories. +# +# ------------------------------------------------------------------------------ +# +# CMake was initially developed by Kitware with the following sponsorship: +# +# * National Library of Medicine at the National Institutes of Health +# as part of the Insight Segmentation and Registration Toolkit (ITK). +# +# * US National Labs (Los Alamos, Livermore, Sandia) ASC Parallel +# Visualization Initiative. +# +# * National Alliance for Medical Image Computing (NAMIC) is funded by the +# National Institutes of Health through the NIH Roadmap for Medical Research, +# Grant U54 EB005149. +# +# * Kitware, Inc. +# #============================================================================= -# (To distributed this file outside of CMake, substitute the full -# License text for the above reference.) -IF (UNIX) - SET(X11_FOUND 0) +MACRO(X11_FIND_INCLUDE_PATH component header) + find_path(X11_${component}_INCLUDE_PATH ${header} ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) + set(X11_HDR_VARS ${X11_HDR_VARS} X11_${component}_INCLUDE_PATH) + if(X11_${component}_INCLUDE_PATH) + set(X11_HDR_PATHS ${X11_HDR_PATHS} ${X11_${component}_INCLUDE_PATH}) + list(REMOVE_DUPLICATES X11_HDR_PATHS) + endif(X11_${component}_INCLUDE_PATH) +ENDMACRO(X11_FIND_INCLUDE_PATH) + +MACRO(X11_FIND_LIB_PATH component libname) + find_library(X11_${component}_LIB ${libname} ${X11_LIB_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) + set(X11_LIB_VARS ${X11_LIB_VARS} X11_${component}_LIB) + if(X11_${component}_LIB) + get_filename_component(X11_${component}_DIR ${X11_${component}_LIB} PATH) + set(X11_LIB_PATHS ${X11_LIB_PATHS} ${X11_${component}_DIR}) + list(REMOVE_DUPLICATES X11_LIB_PATHS) + endif(X11_${component}_LIB) +ENDMACRO(X11_FIND_LIB_PATH) + +if(UNIX) + set(X11_FOUND 0) # X11 is never a framework and some header files may be # found in tcl on the mac - SET(CMAKE_FIND_FRAMEWORK_SAVE ${CMAKE_FIND_FRAMEWORK}) - SET(CMAKE_FIND_FRAMEWORK NEVER) - SET(X11_INC_SEARCH_PATH + set(CMAKE_FIND_FRAMEWORK_SAVE ${CMAKE_FIND_FRAMEWORK}) + set(CMAKE_FIND_FRAMEWORK NEVER) + + + # See whether we're looking for 32 or 64 bit libraries + get_property(SEARCH_64BIT GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS) + if(SEARCH_64BIT) + set(64BIT_DIRS "/usr/lib64/X11;/usr/lib64;/usr/lib/x86_64-linux-gnu") + else(SEARCH_64BIT) + set(32BIT_DIRS "/usr/lib/X11;/usr/lib") + endif(SEARCH_64BIT) + + # Candidate directories for headers + set(X11_INC_SEARCH_PATH /usr/X11/include /usr/include /usr/include/X11 @@ -67,16 +178,10 @@ /usr/openwin/include /usr/pkg/xorg/include /opt/graphics/OpenGL/include - ) + ) - GET_PROPERTY(SEARCH_64BIT GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS) - IF(SEARCH_64BIT) - SET(64BIT_DIRS "/usr/lib64/X11;/usr/lib64;/usr/lib/x86_64-linux-gnu") - ELSE(SEARCH_64BIT) - SET(32BIT_DIRS "/usr/lib/X11;/usr/lib") - ENDIF(SEARCH_64BIT) - - SET(X11_LIB_SEARCH_PATH + # Candidate directories for libraries. + set(X11_LIB_SEARCH_PATH ${64BIT_DIRS} ${32BIT_DIRS} /usr/X11/lib @@ -84,319 +189,364 @@ /usr/X11R6/lib /usr/openwin/lib /usr/pkg/xorg/lib - ) + ) - FIND_PATH(X11_X11_INCLUDE_PATH X11/X.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - FIND_PATH(X11_Xlib_INCLUDE_PATH X11/Xlib.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) + # Just in case, clear our lists + set(X11_HDR_VARS) + set(X11_HDR_PATHS) + set(X11_LIB_VARS) + set(X11_LIB_PATHS) + + # Find primary X11 headers + X11_FIND_INCLUDE_PATH(X11 X11/X.h) + X11_FIND_INCLUDE_PATH(Xlib X11/Xlib.h) + # Look for other X11 includes; keep the list sorted by name of the cmake X11_<component>_INCLUDE_PATH + # variable (component doesn't need to match the include file name). + X11_FIND_INCLUDE_PATH(ICE X11/ICE/ICE.h) + X11_FIND_INCLUDE_PATH(Xaccessrules X11/extensions/XKBrules.h) + X11_FIND_INCLUDE_PATH(Xaccessstr X11/extensions/XKBstr.h) + X11_FIND_INCLUDE_PATH(Xau X11/Xauth.h) + X11_FIND_INCLUDE_PATH(Xcomposite X11/extensions/Xcomposite.h) + X11_FIND_INCLUDE_PATH(Xcursor X11/Xcursor/Xcursor.h) + X11_FIND_INCLUDE_PATH(Xdamage X11/extensions/Xdamage.h) + X11_FIND_INCLUDE_PATH(Xdmcp X11/Xdmcp.h) + X11_FIND_INCLUDE_PATH(dpms X11/extensions/dpms.h) + X11_FIND_INCLUDE_PATH(xf86misc X11/extensions/xf86misc.h) + X11_FIND_INCLUDE_PATH(xf86vmode X11/extensions/xf86vmode.h) + X11_FIND_INCLUDE_PATH(Xfixes X11/extensions/Xfixes.h) + X11_FIND_INCLUDE_PATH(Xft X11/Xft/Xft.h) + X11_FIND_INCLUDE_PATH(Xi X11/extensions/XInput.h) + X11_FIND_INCLUDE_PATH(Xinerama X11/extensions/Xinerama.h) + X11_FIND_INCLUDE_PATH(Xinput X11/extensions/XInput.h) + X11_FIND_INCLUDE_PATH(Xkb X11/extensions/XKB.h) + X11_FIND_INCLUDE_PATH(Xkblib X11/XKBlib.h) + X11_FIND_INCLUDE_PATH(Xpm X11/xpm.h) + X11_FIND_INCLUDE_PATH(XTest X11/extensions/XTest.h) + X11_FIND_INCLUDE_PATH(XShm X11/extensions/XShm.h) + X11_FIND_INCLUDE_PATH(Xrandr X11/extensions/Xrandr.h) + X11_FIND_INCLUDE_PATH(Xrender X11/extensions/Xrender.h) + X11_FIND_INCLUDE_PATH(Xscreensaver X11/extensions/scrnsaver.h) + X11_FIND_INCLUDE_PATH(Xshape X11/extensions/shape.h) + X11_FIND_INCLUDE_PATH(Xutil X11/Xutil.h) + X11_FIND_INCLUDE_PATH(Xt X11/Intrinsic.h) + X11_FIND_INCLUDE_PATH(Xv X11/extensions/Xvlib.h) + - # Look for includes; keep the list sorted by name of the cmake *_INCLUDE_PATH - # variable (which doesn't need to match the include file name). - - # Solaris lacks XKBrules.h, so we should skip kxkbd there. - FIND_PATH(X11_ICE_INCLUDE_PATH X11/ICE/ICE.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - FIND_PATH(X11_Xaccessrules_INCLUDE_PATH X11/extensions/XKBrules.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - FIND_PATH(X11_Xaccessstr_INCLUDE_PATH X11/extensions/XKBstr.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - FIND_PATH(X11_Xau_INCLUDE_PATH X11/Xauth.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - FIND_PATH(X11_Xcomposite_INCLUDE_PATH X11/extensions/Xcomposite.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - FIND_PATH(X11_Xcursor_INCLUDE_PATH X11/Xcursor/Xcursor.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - FIND_PATH(X11_Xdamage_INCLUDE_PATH X11/extensions/Xdamage.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - FIND_PATH(X11_Xdmcp_INCLUDE_PATH X11/Xdmcp.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - FIND_PATH(X11_dpms_INCLUDE_PATH X11/extensions/dpms.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - FIND_PATH(X11_xf86misc_INCLUDE_PATH X11/extensions/xf86misc.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - FIND_PATH(X11_xf86vmode_INCLUDE_PATH X11/extensions/xf86vmode.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - FIND_PATH(X11_Xfixes_INCLUDE_PATH X11/extensions/Xfixes.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - FIND_PATH(X11_Xft_INCLUDE_PATH X11/Xft/Xft.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - FIND_PATH(X11_Xi_INCLUDE_PATH X11/extensions/XInput.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - FIND_PATH(X11_Xinerama_INCLUDE_PATH X11/extensions/Xinerama.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - FIND_PATH(X11_Xinput_INCLUDE_PATH X11/extensions/XInput.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - FIND_PATH(X11_Xkb_INCLUDE_PATH X11/extensions/XKB.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - FIND_PATH(X11_Xkblib_INCLUDE_PATH X11/XKBlib.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - FIND_PATH(X11_Xpm_INCLUDE_PATH X11/xpm.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - FIND_PATH(X11_XTest_INCLUDE_PATH X11/extensions/XTest.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - FIND_PATH(X11_XShm_INCLUDE_PATH X11/extensions/XShm.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - FIND_PATH(X11_Xrandr_INCLUDE_PATH X11/extensions/Xrandr.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - FIND_PATH(X11_Xrender_INCLUDE_PATH X11/extensions/Xrender.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - FIND_PATH(X11_Xscreensaver_INCLUDE_PATH X11/extensions/scrnsaver.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - FIND_PATH(X11_Xshape_INCLUDE_PATH X11/extensions/shape.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - FIND_PATH(X11_Xutil_INCLUDE_PATH X11/Xutil.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - FIND_PATH(X11_Xt_INCLUDE_PATH X11/Intrinsic.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - FIND_PATH(X11_Xv_INCLUDE_PATH X11/extensions/Xvlib.h ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - - - FIND_LIBRARY(X11_X11_LIB X11 ${X11_LIB_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - + # Find primary X11 library + X11_FIND_LIB_PATH(X11 X11) # Find additional X libraries. Keep list sorted by library name. - FIND_LIBRARY(X11_ICE_LIB ICE ${X11_LIB_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - FIND_LIBRARY(X11_SM_LIB SM ${X11_LIB_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - FIND_LIBRARY(X11_Xau_LIB Xau ${X11_LIB_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - FIND_LIBRARY(X11_Xcomposite_LIB Xcomposite ${X11_LIB_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - FIND_LIBRARY(X11_Xcursor_LIB Xcursor ${X11_LIB_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - FIND_LIBRARY(X11_Xdamage_LIB Xdamage ${X11_LIB_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - FIND_LIBRARY(X11_Xdmcp_LIB Xdmcp ${X11_LIB_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - FIND_LIBRARY(X11_Xext_LIB Xext ${X11_LIB_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - FIND_LIBRARY(X11_Xfixes_LIB Xfixes ${X11_LIB_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - FIND_LIBRARY(X11_Xft_LIB Xft ${X11_LIB_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - FIND_LIBRARY(X11_Xi_LIB Xi ${X11_LIB_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - FIND_LIBRARY(X11_Xinerama_LIB Xinerama ${X11_LIB_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - FIND_LIBRARY(X11_Xinput_LIB Xi ${X11_LIB_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - FIND_LIBRARY(X11_Xpm_LIB Xpm ${X11_LIB_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - FIND_LIBRARY(X11_Xrandr_LIB Xrandr ${X11_LIB_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - FIND_LIBRARY(X11_Xrender_LIB Xrender ${X11_LIB_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - FIND_LIBRARY(X11_Xscreensaver_LIB Xss ${X11_LIB_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - FIND_LIBRARY(X11_Xt_LIB Xt ${X11_LIB_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - FIND_LIBRARY(X11_XTest_LIB Xtst ${X11_LIB_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - FIND_LIBRARY(X11_Xv_LIB Xv ${X11_LIB_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) - FIND_LIBRARY(X11_Xxf86misc_LIB Xxf86misc ${X11_LIB_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) + X11_FIND_LIB_PATH(ICE ICE) + X11_FIND_LIB_PATH(SM SM) + X11_FIND_LIB_PATH(Xau Xau) + X11_FIND_LIB_PATH(Xcomposite Xcomposite) + X11_FIND_LIB_PATH(Xcursor Xcursor) + X11_FIND_LIB_PATH(Xdamage Xdamage) + X11_FIND_LIB_PATH(Xdmcp Xdmcp) + X11_FIND_LIB_PATH(Xext Xext) + X11_FIND_LIB_PATH(Xfixes Xfixes) + X11_FIND_LIB_PATH(Xft Xft) + X11_FIND_LIB_PATH(Xi Xi) + X11_FIND_LIB_PATH(Xinerama Xinerama) + X11_FIND_LIB_PATH(Xpm Xpm) + X11_FIND_LIB_PATH(Xrandr Xrandr) + X11_FIND_LIB_PATH(Xrender Xrender) + X11_FIND_LIB_PATH(Xscreensaver Xss) + X11_FIND_LIB_PATH(Xt Xt) + X11_FIND_LIB_PATH(XTest Xtst) + X11_FIND_LIB_PATH(Xv Xv) + X11_FIND_LIB_PATH(Xxf86misc Xxf86misc) - SET(X11_LIBRARY_DIR "") - IF(X11_X11_LIB) - GET_FILENAME_COMPONENT(X11_LIBRARY_DIR ${X11_X11_LIB} PATH) - ENDIF(X11_X11_LIB) + set(X11_LIBRARY_DIR "") + if(X11_X11_LIB) + get_filename_component(X11_LIBRARY_DIR ${X11_X11_LIB} PATH) + endif(X11_X11_LIB) - SET(X11_INCLUDE_DIR) # start with empty list - IF(X11_X11_INCLUDE_PATH) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_X11_INCLUDE_PATH}) - ENDIF(X11_X11_INCLUDE_PATH) + set(X11_INCLUDE_DIR) # start with empty list + if(X11_X11_INCLUDE_PATH) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_X11_INCLUDE_PATH}) + endif(X11_X11_INCLUDE_PATH) - IF(X11_Xlib_INCLUDE_PATH) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xlib_INCLUDE_PATH}) - ENDIF(X11_Xlib_INCLUDE_PATH) + if(X11_Xlib_INCLUDE_PATH) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xlib_INCLUDE_PATH}) + endif(X11_Xlib_INCLUDE_PATH) - IF(X11_Xutil_INCLUDE_PATH) - SET(X11_Xutil_FOUND TRUE) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xutil_INCLUDE_PATH}) - ENDIF(X11_Xutil_INCLUDE_PATH) + if(X11_Xutil_INCLUDE_PATH) + set(X11_Xutil_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xutil_INCLUDE_PATH}) + endif(X11_Xutil_INCLUDE_PATH) - IF(X11_Xshape_INCLUDE_PATH) - SET(X11_Xshape_FOUND TRUE) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xshape_INCLUDE_PATH}) - ENDIF(X11_Xshape_INCLUDE_PATH) + if(X11_Xshape_INCLUDE_PATH) + set(X11_Xshape_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xshape_INCLUDE_PATH}) + endif(X11_Xshape_INCLUDE_PATH) + + # We'll need a variable containing all X11 libraries found + set(X11_LIBRARIES) # start with empty list - SET(X11_LIBRARIES) # start with empty list - IF(X11_X11_LIB) - SET(X11_LIBRARIES ${X11_LIBRARIES} ${X11_X11_LIB}) - ENDIF(X11_X11_LIB) + if(X11_X11_LIB) + set(X11_LIBRARIES ${X11_LIBRARIES} ${X11_X11_LIB}) + endif(X11_X11_LIB) - IF(X11_Xext_LIB) - SET(X11_Xext_FOUND TRUE) - SET(X11_LIBRARIES ${X11_LIBRARIES} ${X11_Xext_LIB}) - ENDIF(X11_Xext_LIB) + if(X11_Xext_LIB) + set(X11_Xext_FOUND TRUE) + set(X11_LIBRARIES ${X11_LIBRARIES} ${X11_Xext_LIB}) + endif(X11_Xext_LIB) - IF(X11_Xt_LIB AND X11_Xt_INCLUDE_PATH) - SET(X11_Xt_FOUND TRUE) - ENDIF(X11_Xt_LIB AND X11_Xt_INCLUDE_PATH) + if(X11_Xt_LIB AND X11_Xt_INCLUDE_PATH) + set(X11_Xt_FOUND TRUE) + endif(X11_Xt_LIB AND X11_Xt_INCLUDE_PATH) - IF(X11_Xft_LIB AND X11_Xft_INCLUDE_PATH) - SET(X11_Xft_FOUND TRUE) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xft_INCLUDE_PATH}) - ENDIF(X11_Xft_LIB AND X11_Xft_INCLUDE_PATH) + if(X11_Xft_LIB AND X11_Xft_INCLUDE_PATH) + set(X11_Xft_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xft_INCLUDE_PATH}) + endif(X11_Xft_LIB AND X11_Xft_INCLUDE_PATH) - IF(X11_Xv_LIB AND X11_Xv_INCLUDE_PATH) - SET(X11_Xv_FOUND TRUE) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xv_INCLUDE_PATH}) - ENDIF(X11_Xv_LIB AND X11_Xv_INCLUDE_PATH) + if(X11_Xv_LIB AND X11_Xv_INCLUDE_PATH) + set(X11_Xv_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xv_INCLUDE_PATH}) + endif(X11_Xv_LIB AND X11_Xv_INCLUDE_PATH) - IF (X11_Xau_LIB AND X11_Xau_INCLUDE_PATH) - SET(X11_Xau_FOUND TRUE) - ENDIF (X11_Xau_LIB AND X11_Xau_INCLUDE_PATH) + if(X11_Xau_LIB AND X11_Xau_INCLUDE_PATH) + set(X11_Xau_FOUND TRUE) + endif(X11_Xau_LIB AND X11_Xau_INCLUDE_PATH) - IF (X11_Xdmcp_INCLUDE_PATH AND X11_Xdmcp_LIB) - SET(X11_Xdmcp_FOUND TRUE) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xdmcp_INCLUDE_PATH}) - ENDIF (X11_Xdmcp_INCLUDE_PATH AND X11_Xdmcp_LIB) + if(X11_Xdmcp_INCLUDE_PATH AND X11_Xdmcp_LIB) + set(X11_Xdmcp_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xdmcp_INCLUDE_PATH}) + endif(X11_Xdmcp_INCLUDE_PATH AND X11_Xdmcp_LIB) - IF (X11_Xaccessrules_INCLUDE_PATH AND X11_Xaccessstr_INCLUDE_PATH) - SET(X11_Xaccess_FOUND TRUE) - SET(X11_Xaccess_INCLUDE_PATH ${X11_Xaccessstr_INCLUDE_PATH}) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xaccess_INCLUDE_PATH}) - ENDIF (X11_Xaccessrules_INCLUDE_PATH AND X11_Xaccessstr_INCLUDE_PATH) + if(X11_Xaccessrules_INCLUDE_PATH AND X11_Xaccessstr_INCLUDE_PATH) + set(X11_Xaccess_FOUND TRUE) + set(X11_Xaccess_INCLUDE_PATH ${X11_Xaccessstr_INCLUDE_PATH}) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xaccess_INCLUDE_PATH}) + endif(X11_Xaccessrules_INCLUDE_PATH AND X11_Xaccessstr_INCLUDE_PATH) - IF (X11_Xpm_INCLUDE_PATH AND X11_Xpm_LIB) - SET(X11_Xpm_FOUND TRUE) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xpm_INCLUDE_PATH}) - ENDIF (X11_Xpm_INCLUDE_PATH AND X11_Xpm_LIB) + if(X11_Xpm_INCLUDE_PATH AND X11_Xpm_LIB) + set(X11_Xpm_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xpm_INCLUDE_PATH}) + endif(X11_Xpm_INCLUDE_PATH AND X11_Xpm_LIB) - IF (X11_Xcomposite_INCLUDE_PATH AND X11_Xcomposite_LIB) - SET(X11_Xcomposite_FOUND TRUE) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xcomposite_INCLUDE_PATH}) - ENDIF (X11_Xcomposite_INCLUDE_PATH AND X11_Xcomposite_LIB) + if(X11_Xcomposite_INCLUDE_PATH AND X11_Xcomposite_LIB) + set(X11_Xcomposite_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xcomposite_INCLUDE_PATH}) + endif(X11_Xcomposite_INCLUDE_PATH AND X11_Xcomposite_LIB) - IF (X11_Xdamage_INCLUDE_PATH AND X11_Xdamage_LIB) - SET(X11_Xdamage_FOUND TRUE) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xdamage_INCLUDE_PATH}) - ENDIF (X11_Xdamage_INCLUDE_PATH AND X11_Xdamage_LIB) + if(X11_Xdamage_INCLUDE_PATH AND X11_Xdamage_LIB) + set(X11_Xdamage_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xdamage_INCLUDE_PATH}) + endif(X11_Xdamage_INCLUDE_PATH AND X11_Xdamage_LIB) - IF (X11_XShm_INCLUDE_PATH) - SET(X11_XShm_FOUND TRUE) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_XShm_INCLUDE_PATH}) - ENDIF (X11_XShm_INCLUDE_PATH) + if(X11_XShm_INCLUDE_PATH) + set(X11_XShm_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_XShm_INCLUDE_PATH}) + endif(X11_XShm_INCLUDE_PATH) - IF (X11_XTest_INCLUDE_PATH AND X11_XTest_LIB) - SET(X11_XTest_FOUND TRUE) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_XTest_INCLUDE_PATH}) - ENDIF (X11_XTest_INCLUDE_PATH AND X11_XTest_LIB) + if(X11_XTest_INCLUDE_PATH AND X11_XTest_LIB) + set(X11_XTest_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_XTest_INCLUDE_PATH}) + endif(X11_XTest_INCLUDE_PATH AND X11_XTest_LIB) - IF (X11_Xi_INCLUDE_PATH AND X11_Xi_LIB) - SET(X11_Xi_FOUND TRUE) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xi_INCLUDE_PATH}) - ENDIF (X11_Xi_INCLUDE_PATH AND X11_Xi_LIB) + if(X11_Xi_INCLUDE_PATH AND X11_Xi_LIB) + set(X11_Xi_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xi_INCLUDE_PATH}) + endif(X11_Xi_INCLUDE_PATH AND X11_Xi_LIB) - IF (X11_Xinerama_INCLUDE_PATH AND X11_Xinerama_LIB) - SET(X11_Xinerama_FOUND TRUE) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xinerama_INCLUDE_PATH}) - ENDIF (X11_Xinerama_INCLUDE_PATH AND X11_Xinerama_LIB) + if(X11_Xinerama_INCLUDE_PATH AND X11_Xinerama_LIB) + set(X11_Xinerama_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xinerama_INCLUDE_PATH}) + endif(X11_Xinerama_INCLUDE_PATH AND X11_Xinerama_LIB) - IF (X11_Xfixes_INCLUDE_PATH AND X11_Xfixes_LIB) - SET(X11_Xfixes_FOUND TRUE) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xfixes_INCLUDE_PATH}) - ENDIF (X11_Xfixes_INCLUDE_PATH AND X11_Xfixes_LIB) + if(X11_Xfixes_INCLUDE_PATH AND X11_Xfixes_LIB) + set(X11_Xfixes_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xfixes_INCLUDE_PATH}) + endif(X11_Xfixes_INCLUDE_PATH AND X11_Xfixes_LIB) - IF (X11_Xrender_INCLUDE_PATH AND X11_Xrender_LIB) - SET(X11_Xrender_FOUND TRUE) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xrender_INCLUDE_PATH}) - ENDIF (X11_Xrender_INCLUDE_PATH AND X11_Xrender_LIB) + if(X11_Xrender_INCLUDE_PATH AND X11_Xrender_LIB) + set(X11_Xrender_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xrender_INCLUDE_PATH}) + endif(X11_Xrender_INCLUDE_PATH AND X11_Xrender_LIB) - IF (X11_Xrandr_INCLUDE_PATH AND X11_Xrandr_LIB) - SET(X11_Xrandr_FOUND TRUE) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xrandr_INCLUDE_PATH}) - ENDIF (X11_Xrandr_INCLUDE_PATH AND X11_Xrandr_LIB) + if(X11_Xrandr_INCLUDE_PATH AND X11_Xrandr_LIB) + set(X11_Xrandr_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xrandr_INCLUDE_PATH}) + endif(X11_Xrandr_INCLUDE_PATH AND X11_Xrandr_LIB) - IF (X11_xf86misc_INCLUDE_PATH AND X11_Xxf86misc_LIB) - SET(X11_xf86misc_FOUND TRUE) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_xf86misc_INCLUDE_PATH}) - ENDIF (X11_xf86misc_INCLUDE_PATH AND X11_Xxf86misc_LIB) + if(X11_xf86misc_INCLUDE_PATH AND X11_Xxf86misc_LIB) + set(X11_xf86misc_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_xf86misc_INCLUDE_PATH}) + endif(X11_xf86misc_INCLUDE_PATH AND X11_Xxf86misc_LIB) - IF (X11_xf86vmode_INCLUDE_PATH) - SET(X11_xf86vmode_FOUND TRUE) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_xf86vmode_INCLUDE_PATH}) - ENDIF (X11_xf86vmode_INCLUDE_PATH) + if(X11_xf86vmode_INCLUDE_PATH) + set(X11_xf86vmode_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_xf86vmode_INCLUDE_PATH}) + endif(X11_xf86vmode_INCLUDE_PATH) - IF (X11_Xcursor_INCLUDE_PATH AND X11_Xcursor_LIB) - SET(X11_Xcursor_FOUND TRUE) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xcursor_INCLUDE_PATH}) - ENDIF (X11_Xcursor_INCLUDE_PATH AND X11_Xcursor_LIB) + if(X11_Xcursor_INCLUDE_PATH AND X11_Xcursor_LIB) + set(X11_Xcursor_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xcursor_INCLUDE_PATH}) + endif(X11_Xcursor_INCLUDE_PATH AND X11_Xcursor_LIB) - IF (X11_Xscreensaver_INCLUDE_PATH AND X11_Xscreensaver_LIB) - SET(X11_Xscreensaver_FOUND TRUE) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xscreensaver_INCLUDE_PATH}) - ENDIF (X11_Xscreensaver_INCLUDE_PATH AND X11_Xscreensaver_LIB) + if(X11_Xscreensaver_INCLUDE_PATH AND X11_Xscreensaver_LIB) + set(X11_Xscreensaver_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xscreensaver_INCLUDE_PATH}) + endif(X11_Xscreensaver_INCLUDE_PATH AND X11_Xscreensaver_LIB) - IF (X11_dpms_INCLUDE_PATH) - SET(X11_dpms_FOUND TRUE) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_dpms_INCLUDE_PATH}) - ENDIF (X11_dpms_INCLUDE_PATH) + if(X11_dpms_INCLUDE_PATH) + set(X11_dpms_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_dpms_INCLUDE_PATH}) + endif(X11_dpms_INCLUDE_PATH) - IF (X11_Xkb_INCLUDE_PATH AND X11_Xkblib_INCLUDE_PATH AND X11_Xlib_INCLUDE_PATH) - SET(X11_Xkb_FOUND TRUE) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xkb_INCLUDE_PATH} ) - ENDIF (X11_Xkb_INCLUDE_PATH AND X11_Xkblib_INCLUDE_PATH AND X11_Xlib_INCLUDE_PATH) + if(X11_Xkb_INCLUDE_PATH AND X11_Xkblib_INCLUDE_PATH AND X11_Xlib_INCLUDE_PATH) + set(X11_Xkb_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xkb_INCLUDE_PATH} ) + endif(X11_Xkb_INCLUDE_PATH AND X11_Xkblib_INCLUDE_PATH AND X11_Xlib_INCLUDE_PATH) - IF (X11_Xinput_INCLUDE_PATH AND X11_Xinput_LIB) - SET(X11_Xinput_FOUND TRUE) - SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xinput_INCLUDE_PATH}) - ENDIF (X11_Xinput_INCLUDE_PATH AND X11_Xinput_LIB) + if(X11_Xinput_INCLUDE_PATH AND X11_Xinput_LIB) + set(X11_Xinput_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xinput_INCLUDE_PATH}) + endif(X11_Xinput_INCLUDE_PATH AND X11_Xinput_LIB) - IF(X11_ICE_LIB AND X11_ICE_INCLUDE_PATH) - SET(X11_ICE_FOUND TRUE) - ENDIF(X11_ICE_LIB AND X11_ICE_INCLUDE_PATH) + if(X11_ICE_LIB AND X11_ICE_INCLUDE_PATH) + set(X11_ICE_FOUND TRUE) + endif(X11_ICE_LIB AND X11_ICE_INCLUDE_PATH) # Deprecated variable for backwards compatibility with CMake 1.4 - IF (X11_X11_INCLUDE_PATH AND X11_LIBRARIES) - SET(X11_FOUND 1) - ENDIF (X11_X11_INCLUDE_PATH AND X11_LIBRARIES) + if(X11_X11_INCLUDE_PATH AND X11_LIBRARIES) + set(X11_FOUND 1) + endif(X11_X11_INCLUDE_PATH AND X11_LIBRARIES) - IF(X11_FOUND) - INCLUDE(CheckFunctionExists) - INCLUDE(CheckLibraryExists) + if(X11_FOUND) + include(CheckFunctionExists) + include(CheckLibraryExists) # Translated from an autoconf-generated configure script. # See libs.m4 in autoconf's m4 directory. - IF($ENV{ISC} MATCHES "^yes$") - SET(X11_X_EXTRA_LIBS -lnsl_s -linet) - ELSE($ENV{ISC} MATCHES "^yes$") - SET(X11_X_EXTRA_LIBS "") + if($ENV{ISC} MATCHES "^yes$") + set(X11_X_EXTRA_LIBS -lnsl_s -linet) + else($ENV{ISC} MATCHES "^yes$") + set(X11_X_EXTRA_LIBS "") # See if XOpenDisplay in X11 works by itself. CHECK_LIBRARY_EXISTS("${X11_LIBRARIES}" "XOpenDisplay" "${X11_LIBRARY_DIR}" X11_LIB_X11_SOLO) - IF(NOT X11_LIB_X11_SOLO) + if(NOT X11_LIB_X11_SOLO) # Find library needed for dnet_ntoa. CHECK_LIBRARY_EXISTS("dnet" "dnet_ntoa" "" X11_LIB_DNET_HAS_DNET_NTOA) - IF (X11_LIB_DNET_HAS_DNET_NTOA) + if(X11_LIB_DNET_HAS_DNET_NTOA) SET (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -ldnet) - ELSE (X11_LIB_DNET_HAS_DNET_NTOA) + else(X11_LIB_DNET_HAS_DNET_NTOA) CHECK_LIBRARY_EXISTS("dnet_stub" "dnet_ntoa" "" X11_LIB_DNET_STUB_HAS_DNET_NTOA) - IF (X11_LIB_DNET_STUB_HAS_DNET_NTOA) + if(X11_LIB_DNET_STUB_HAS_DNET_NTOA) SET (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -ldnet_stub) - ENDIF (X11_LIB_DNET_STUB_HAS_DNET_NTOA) - ENDIF (X11_LIB_DNET_HAS_DNET_NTOA) - ENDIF(NOT X11_LIB_X11_SOLO) + endif(X11_LIB_DNET_STUB_HAS_DNET_NTOA) + endif(X11_LIB_DNET_HAS_DNET_NTOA) + endif(NOT X11_LIB_X11_SOLO) # Find library needed for gethostbyname. CHECK_FUNCTION_EXISTS("gethostbyname" CMAKE_HAVE_GETHOSTBYNAME) - IF(NOT CMAKE_HAVE_GETHOSTBYNAME) + if(NOT CMAKE_HAVE_GETHOSTBYNAME) CHECK_LIBRARY_EXISTS("nsl" "gethostbyname" "" CMAKE_LIB_NSL_HAS_GETHOSTBYNAME) - IF (CMAKE_LIB_NSL_HAS_GETHOSTBYNAME) + if(CMAKE_LIB_NSL_HAS_GETHOSTBYNAME) SET (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -lnsl) - ELSE (CMAKE_LIB_NSL_HAS_GETHOSTBYNAME) + else(CMAKE_LIB_NSL_HAS_GETHOSTBYNAME) CHECK_LIBRARY_EXISTS("bsd" "gethostbyname" "" CMAKE_LIB_BSD_HAS_GETHOSTBYNAME) - IF (CMAKE_LIB_BSD_HAS_GETHOSTBYNAME) + if(CMAKE_LIB_BSD_HAS_GETHOSTBYNAME) SET (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -lbsd) - ENDIF (CMAKE_LIB_BSD_HAS_GETHOSTBYNAME) - ENDIF (CMAKE_LIB_NSL_HAS_GETHOSTBYNAME) - ENDIF(NOT CMAKE_HAVE_GETHOSTBYNAME) + endif(CMAKE_LIB_BSD_HAS_GETHOSTBYNAME) + endif(CMAKE_LIB_NSL_HAS_GETHOSTBYNAME) + endif(NOT CMAKE_HAVE_GETHOSTBYNAME) # Find library needed for connect. CHECK_FUNCTION_EXISTS("connect" CMAKE_HAVE_CONNECT) - IF(NOT CMAKE_HAVE_CONNECT) + if(NOT CMAKE_HAVE_CONNECT) CHECK_LIBRARY_EXISTS("socket" "connect" "" CMAKE_LIB_SOCKET_HAS_CONNECT) - IF (CMAKE_LIB_SOCKET_HAS_CONNECT) + if(CMAKE_LIB_SOCKET_HAS_CONNECT) SET (X11_X_EXTRA_LIBS -lsocket ${X11_X_EXTRA_LIBS}) - ENDIF (CMAKE_LIB_SOCKET_HAS_CONNECT) - ENDIF(NOT CMAKE_HAVE_CONNECT) + endif(CMAKE_LIB_SOCKET_HAS_CONNECT) + endif(NOT CMAKE_HAVE_CONNECT) # Find library needed for remove. CHECK_FUNCTION_EXISTS("remove" CMAKE_HAVE_REMOVE) - IF(NOT CMAKE_HAVE_REMOVE) + if(NOT CMAKE_HAVE_REMOVE) CHECK_LIBRARY_EXISTS("posix" "remove" "" CMAKE_LIB_POSIX_HAS_REMOVE) - IF (CMAKE_LIB_POSIX_HAS_REMOVE) + if(CMAKE_LIB_POSIX_HAS_REMOVE) SET (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -lposix) - ENDIF (CMAKE_LIB_POSIX_HAS_REMOVE) - ENDIF(NOT CMAKE_HAVE_REMOVE) + endif(CMAKE_LIB_POSIX_HAS_REMOVE) + endif(NOT CMAKE_HAVE_REMOVE) # Find library needed for shmat. CHECK_FUNCTION_EXISTS("shmat" CMAKE_HAVE_SHMAT) - IF(NOT CMAKE_HAVE_SHMAT) + if(NOT CMAKE_HAVE_SHMAT) CHECK_LIBRARY_EXISTS("ipc" "shmat" "" CMAKE_LIB_IPS_HAS_SHMAT) - IF (CMAKE_LIB_IPS_HAS_SHMAT) + if(CMAKE_LIB_IPS_HAS_SHMAT) SET (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -lipc) - ENDIF (CMAKE_LIB_IPS_HAS_SHMAT) - ENDIF(NOT CMAKE_HAVE_SHMAT) - ENDIF($ENV{ISC} MATCHES "^yes$") + endif(CMAKE_LIB_IPS_HAS_SHMAT) + endif(NOT CMAKE_HAVE_SHMAT) + endif($ENV{ISC} MATCHES "^yes$") - IF (X11_ICE_FOUND) + if(X11_ICE_FOUND) CHECK_LIBRARY_EXISTS("ICE" "IceConnectionNumber" "${X11_LIBRARY_DIR}" - CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER) - IF(CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER) + CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER) + if(CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER) SET (X11_X_PRE_LIBS ${X11_ICE_LIB}) - IF(X11_SM_LIB) + if(X11_SM_LIB) SET (X11_X_PRE_LIBS ${X11_SM_LIB} ${X11_X_PRE_LIBS}) - ENDIF(X11_SM_LIB) - ENDIF(CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER) - ENDIF (X11_ICE_FOUND) + endif(X11_SM_LIB) + endif(CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER) + endif(X11_ICE_FOUND) # Build the final list of libraries. - SET(X11_LIBRARIES ${X11_X_PRE_LIBS} ${X11_LIBRARIES} ${X11_X_EXTRA_LIBS}) + set(X11_LIBRARIES ${X11_X_PRE_LIBS} ${X11_LIBRARIES} ${X11_X_EXTRA_LIBS}) - INCLUDE(FindPackageMessage) + # Check whether we're pulling headers from multiple directoreis + list(LENGTH X11_HDR_PATHS HDR_PATH_CNT) + if("${HDR_PATH_CNT}" GREATER 1) + message("\nNote: FindX11 is returning headers found in multiple paths. The user may wish to verify that components are not being returned from multiple X11 installations.\n") + if(CMAKE_SEARCH_OSX_PATHS) + if(NOT "${CMAKE_SEARCH_OSX_PATHS}" STREQUAL "SYSTEM") + message("Note that CMAKE_SEARCH_OSX_PATHS is set to ${CMAKE_SEARCH_OSX_PATHS} - if ${CMAKE_SEARCH_OSX_PATHS} has an incomplete installation of X11, that may cause this issue - a possible workaround is to set CMAKE_SEARCH_OSX_PATHS to SYSTEM and not use ${CMAKE_SEARCH_OSX_PATHS}.\n") + endif(NOT "${CMAKE_SEARCH_OSX_PATHS}" STREQUAL "SYSTEM") + endif(CMAKE_SEARCH_OSX_PATHS) + foreach(pathitem ${X11_HDR_PATHS}) + message("Headers found in ${pathitem}:") + foreach(varitem ${X11_HDR_VARS}) + if("${${varitem}}" MATCHES "${pathitem}") + message(" ${varitem}:${${varitem}}") + endif("${${varitem}}" MATCHES "${pathitem}") + endforeach(varitem ${X11_HDR_PATHS}) + message(" ") + endforeach(pathitem ${X11_HDR_PATHS}) + endif("${HDR_PATH_CNT}" GREATER 1) + + list(LENGTH X11_LIB_PATHS LIB_PATH_CNT) + if("${LIB_PATH_CNT}" GREATER 1) + message("\nNote: FindX11 is returning libraries found in multiple paths. The user may wish to verify that components are not being returned from multiple X11 installations.\n") + if(CMAKE_SEARCH_OSX_PATHS) + if(NOT "${CMAKE_SEARCH_OSX_PATHS}" STREQUAL "SYSTEM") + message("Note that CMAKE_SEARCH_OSX_PATHS is set to ${CMAKE_SEARCH_OSX_PATHS} - if ${CMAKE_SEARCH_OSX_PATHS} has an incomplete installation of X11, that may cause this issue - a possible workaround is to set CMAKE_SEARCH_OSX_PATHS to SYSTEM and not use ${CMAKE_SEARCH_OSX_PATHS}.\n") + endif(NOT "${CMAKE_SEARCH_OSX_PATHS}" STREQUAL "SYSTEM") + endif(CMAKE_SEARCH_OSX_PATHS) + + foreach(pathitem ${X11_LIB_PATHS}) + message("Libraries found in ${pathitem}:") + foreach(varitem ${X11_LIB_VARS}) + if("${${varitem}}" MATCHES "${pathitem}") + message(" ${varitem}:${${varitem}}") + endif("${${varitem}}" MATCHES "${pathitem}") + endforeach(varitem ${X11_LIB_PATHS}) + message(" ") + endforeach(pathitem ${X11_LIB_PATHS}) + endif("${LIB_PATH_CNT}" GREATER 1) + + include(FindPackageMessage) FIND_PACKAGE_MESSAGE(X11 "Found X11: ${X11_X11_LIB}" "[${X11_X11_LIB}][${X11_INCLUDE_DIR}]") - ELSE (X11_FOUND) - IF (X11_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "Could not find X11") - ENDIF (X11_FIND_REQUIRED) - ENDIF (X11_FOUND) + else(X11_FOUND) + if(X11_FIND_REQUIRED) + message(FATAL_ERROR "Could not find X11") + endif(X11_FIND_REQUIRED) + endif(X11_FOUND) - MARK_AS_ADVANCED( + mark_as_advanced( X11_X11_INCLUDE_PATH X11_X11_LIB X11_Xext_LIB @@ -451,8 +601,15 @@ X11_ICE_LIB X11_ICE_INCLUDE_PATH X11_SM_LIB - ) - SET(CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK_SAVE}) -ENDIF (UNIX) + ) + set(CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK_SAVE}) +endif(UNIX) # X11_FIND_REQUIRED_<component> could be checked too + +# Local Variables: +# tab-width: 8 +# mode: cmake +# indent-tabs-mode: t +# End: +# ex: shiftwidth=4 tabstop=8 Modified: brlcad/trunk/src/other/tk/CMake/FindX11.cmake =================================================================== --- brlcad/trunk/src/other/tk/CMake/FindX11.cmake 2012-01-26 18:38:08 UTC (rev 49105) +++ brlcad/trunk/src/other/tk/CMake/FindX11.cmake 2012-01-26 18:42:19 UTC (rev 49106) @@ -1,3 +1,38 @@ +# F I N D X 1 1 . C M A K E +# BRL-CAD +# +# Copyright (c) 2001-2012 United States Government as represented by +# the U.S. Army Research Laboratory. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# 3. The name of the author may not be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS +# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +### # - Find X11 installation # Try to find X11 on UNIX systems. The following values are defined # X11_FOUND - True if X11 is available @@ -38,24 +73,100 @@ #============================================================================= # Copyright 2001-2009 Kitware, Inc. -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# ------------------------------------------------------------------------------ +# +# The above copyright and license notice applies to distributions of +# CMake in source and binary form. Some source files contain additional +# notices of original copyright by their contributors; see each source +# for details. Third-party software packages supplied with CMake under +# compatible licenses provide their own copyright notices documented in +# corresponding subdirectories. +# +# ------------------------------------------------------------------------------ +# +# CMake was initially developed by Kitware with the following sponsorship: +# +# * National Library of Medicine at the National Institutes of Health +# as part of the Insight Segmentation and Registration Toolkit (ITK). +# +# * US National Labs (Los Alamos, Livermore, Sandia) ASC Parallel +# Visualization Initiative. +# +# * National Alliance for Medical Image Computing (NAMIC) is funded by the +# National Institutes of Health through the NIH Roadmap for Medical Research, +# Grant U54 EB005149. +# +# * Kitware, Inc. +# #============================================================================= -# (To distributed this file outside of CMake, substitute the full -# License text for the above reference.) -IF (UNIX) - SET(X11_FOUND 0) +MACRO(X11_FIND_INCLUDE_PATH component header) + find_path(X11_${component}_INCLUDE_PATH ${header} ${X11_INC_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) + set(X11_HDR_VARS ${X11_HDR_VARS} X11_${component}_INCLUDE_PATH) + if(X11_${component}_INCLUDE_PATH) + set(X11_HDR_PATHS ${X11_HDR_PATHS} ${X11_${component}_INCLUDE_PATH}) + list(REMOVE_DUPLICATES X11_HDR_PATHS) + endif(X11_${component}_INCLUDE_PATH) +ENDMACRO(X11_FIND_INCLUDE_PATH) + +MACRO(X11_FIND_LIB_PATH component libname) + find_library(X11_${component}_LIB ${libname} ${X11_LIB_SEARCH_PATH} NO_CMAKE_SYSTEM_PATH) + set(X11_LIB_VARS ${X11_LIB_VARS} X11_${component}_LIB) + if(X11_${component}_LIB) + get_filename_component(X11_${component}_DIR ${X11_${component}_LIB} PATH) + set(X11_LIB_PATHS ${X11_LIB_PATHS} ${X11_${component}_DIR}) + list(REMOVE_DUPLICATES X11_LIB_PATHS) + endif(X11_${component}_LIB) +ENDMACRO(X11_FIND_LIB_PATH) + +if(UNIX) + set(X11_FOUND 0) # X11 is never a framework and some header files may be # found in tcl on the mac - SET(CMAKE_FIND_FRAMEWORK_SAVE ${CMAKE_FIND_FRAMEWORK}) - SET(CMAKE_FIND_FRAMEWORK NEVER) - SET(X11_INC_SEARCH_PATH + set(CMAKE_FIND_FRAMEWORK_SAVE ${CMAKE_FIND_FRAMEWORK}) + set(CMAKE_FIND_FRAMEWORK NEVER) + + + # See whether we're looking for 32 or 64 bit libraries + get_property(SEARCH_64BIT GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS) + if(SEARCH_64BIT) + set(64BIT_DIRS "/usr/lib64/X11;/usr/lib64;/usr/lib/x86_64-linux-gnu") + else(SEARCH_64BIT) + set(32BIT_DIRS "/usr/lib/X11;/usr/lib") + endif(SEARCH_64BIT) + + # Candidate directories for headers + set(X11_INC_SEARCH_PATH /usr/X11/include /usr/include /usr/include/X11 @@ -67,16 +178,10 @@ /usr/openwin/include /usr/pkg/xorg/include /opt/graphics/OpenGL/include - ) + ) - GET_PROPERTY(SEARCH_64BIT GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS) - IF(SEARCH_64BIT) - SET(64BIT_DIRS "/usr/lib64/X11;/usr/lib64;/usr/lib/x86_64-linux-gnu") - ELSE(SEARCH_64BIT) - SET(32BIT_DIRS "/usr/lib/X11;/usr/lib") - ENDIF(SEARCH_64BIT) - - SET(X11_LIB_SEARCH_PATH + # Candidate directories for libraries. + set(X11_LIB_SEARCH_PATH ${64BIT_DIRS} ${32BIT_DIRS} /usr/X11/lib @@ -84,319 +189,364 @@ /usr/X11R6/lib /usr/openwin/lib /us... [truncated message content] |