Fix FindX11 to match convention
This commit is contained in:
parent
85607bc50b
commit
69762f4d99
|
@ -28,15 +28,15 @@ IF(NOT CMAKE_SKIP_COMPATIBILITY_TESTS)
|
||||||
TEST_BIG_ENDIAN(CMAKE_WORDS_BIGENDIAN)
|
TEST_BIG_ENDIAN(CMAKE_WORDS_BIGENDIAN)
|
||||||
INCLUDE (${CMAKE_ROOT}/Modules/FindX11.cmake)
|
INCLUDE (${CMAKE_ROOT}/Modules/FindX11.cmake)
|
||||||
|
|
||||||
IF("${CMAKE_X11_INCLUDE_PATH}" MATCHES "^/usr/include$")
|
IF("${X11_X11_INCLUDE_PATH}" MATCHES "^/usr/include$")
|
||||||
SET (CMAKE_X_CFLAGS "" CACHE STRING "X11 extra flags.")
|
SET (CMAKE_X_CFLAGS "" CACHE STRING "X11 extra flags.")
|
||||||
ELSE("${CMAKE_X11_INCLUDE_PATH}" MATCHES "^/usr/include$")
|
ELSE("${X11_X11_INCLUDE_PATH}" MATCHES "^/usr/include$")
|
||||||
SET (CMAKE_X_CFLAGS "-I${CMAKE_X11_INCLUDE_PATH}" CACHE STRING
|
SET (CMAKE_X_CFLAGS "-I${X11_X11_INCLUDE_PATH}" CACHE STRING
|
||||||
"X11 extra flags.")
|
"X11 extra flags.")
|
||||||
ENDIF("${CMAKE_X11_INCLUDE_PATH}" MATCHES "^/usr/include$")
|
ENDIF("${X11_X11_INCLUDE_PATH}" MATCHES "^/usr/include$")
|
||||||
SET (CMAKE_X_LIBS "${CMAKE_X_LIBS}" CACHE STRING
|
SET (CMAKE_X_LIBS "${X11_LIBRARIES}" CACHE STRING
|
||||||
"Libraries and options used in X11 programs.")
|
"Libraries and options used in X11 programs.")
|
||||||
SET (CMAKE_HAS_X "${CMAKE_HAS_X}" CACHE INTERNAL "Is X11 around.")
|
SET (CMAKE_HAS_X "${X11_FOUND}" CACHE INTERNAL "Is X11 around.")
|
||||||
|
|
||||||
INCLUDE (${CMAKE_ROOT}/Modules/FindThreads.cmake)
|
INCLUDE (${CMAKE_ROOT}/Modules/FindThreads.cmake)
|
||||||
|
|
||||||
|
|
|
@ -2,14 +2,14 @@
|
||||||
# try to find X11 on UNIX systems.
|
# try to find X11 on UNIX systems.
|
||||||
#
|
#
|
||||||
# The following values are defined
|
# The following values are defined
|
||||||
# CMAKE_HAS_X - True if X11 is available
|
# X11_FOUND - True if X11 is available
|
||||||
# CMAKE_X_INCLUDE_DIRS - include directories to use X11
|
# X11_INCLUDE_DIR - include directories to use X11
|
||||||
# CMAKE_X_LIBS - link against these to use X11
|
# X11_LIBRARIES - link against these to use X11
|
||||||
|
|
||||||
IF (UNIX)
|
IF (UNIX)
|
||||||
SET(CMAKE_HAS_X 0)
|
SET(X11_FOUND 0)
|
||||||
|
|
||||||
SET(CMAKE_X11_INC_SEARCH_PATH
|
SET(X11_INC_SEARCH_PATH
|
||||||
/usr/X11R6/include
|
/usr/X11R6/include
|
||||||
/usr/local/include
|
/usr/local/include
|
||||||
/usr/include/X11
|
/usr/include/X11
|
||||||
|
@ -19,71 +19,71 @@ IF (UNIX)
|
||||||
/usr/include
|
/usr/include
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(CMAKE_X11_LIB_SEARCH_PATH
|
SET(X11_LIB_SEARCH_PATH
|
||||||
/usr/X11R6/lib
|
/usr/X11R6/lib
|
||||||
/usr/local/lib
|
/usr/local/lib
|
||||||
/usr/openwin/lib
|
/usr/openwin/lib
|
||||||
/usr/lib
|
/usr/lib
|
||||||
)
|
)
|
||||||
|
|
||||||
FIND_PATH(CMAKE_X11_INCLUDE_PATH X11/X.h ${CMAKE_X11_INC_SEARCH_PATH})
|
FIND_PATH(X11_X11_INCLUDE_PATH X11/X.h ${X11_INC_SEARCH_PATH})
|
||||||
FIND_PATH(CMAKE_Xlib_INCLUDE_PATH X11/Xlib.h ${CMAKE_X11_INC_SEARCH_PATH})
|
FIND_PATH(X11_Xlib_INCLUDE_PATH X11/Xlib.h ${X11_INC_SEARCH_PATH})
|
||||||
FIND_PATH(CMAKE_Xutil_INCLUDE_PATH X11/Xutil.h ${CMAKE_X11_INC_SEARCH_PATH})
|
FIND_PATH(X11_Xutil_INCLUDE_PATH X11/Xutil.h ${X11_INC_SEARCH_PATH})
|
||||||
FIND_LIBRARY(CMAKE_X11_LIB X11 ${CMAKE_X11_LIB_SEARCH_PATH})
|
FIND_LIBRARY(X11_X11_LIB X11 ${X11_LIB_SEARCH_PATH})
|
||||||
FIND_LIBRARY(CMAKE_Xext_LIB Xext ${CMAKE_X11_LIB_SEARCH_PATH})
|
FIND_LIBRARY(X11_Xext_LIB Xext ${X11_LIB_SEARCH_PATH})
|
||||||
|
|
||||||
IF(CMAKE_X11_INCLUDE_PATH)
|
IF(X11_X11_INCLUDE_PATH)
|
||||||
SET(CMAKE_X_INCLUDE_DIRS ${CMAKE_X_INCLUDE_DIRS} ${CMAKE_X11_INCLUDE_PATH})
|
SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_X11_INCLUDE_PATH})
|
||||||
ENDIF(CMAKE_X11_INCLUDE_PATH)
|
ENDIF(X11_X11_INCLUDE_PATH)
|
||||||
|
|
||||||
IF(CMAKE_Xlib_INCLUDE_PATH)
|
IF(X11_Xlib_INCLUDE_PATH)
|
||||||
SET(CMAKE_X_INCLUDE_DIRS ${CMAKE_X_INCLUDE_DIRS} ${CMAKE_Xlib_INCLUDE_PATH})
|
SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xlib_INCLUDE_PATH})
|
||||||
ENDIF(CMAKE_Xlib_INCLUDE_PATH)
|
ENDIF(X11_Xlib_INCLUDE_PATH)
|
||||||
|
|
||||||
IF(CMAKE_Xutil_INCLUDE_PATH)
|
IF(X11_Xutil_INCLUDE_PATH)
|
||||||
SET(CMAKE_X_INCLUDE_DIRS ${CMAKE_X_INCLUDE_DIRS} ${CMAKE_Xutil_INCLUDE_PATH})
|
SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xutil_INCLUDE_PATH})
|
||||||
ENDIF(CMAKE_Xutil_INCLUDE_PATH)
|
ENDIF(X11_Xutil_INCLUDE_PATH)
|
||||||
|
|
||||||
IF(CMAKE_X11_LIB)
|
IF(X11_X11_LIB)
|
||||||
SET(CMAKE_X_LIBS ${CMAKE_X_LIBS} ${CMAKE_X11_LIB})
|
SET(X11_LIBRARIES ${X11_LIBRARIES} ${X11_X11_LIB})
|
||||||
ENDIF(CMAKE_X11_LIB)
|
ENDIF(X11_X11_LIB)
|
||||||
|
|
||||||
IF(CMAKE_Xext_LIB)
|
IF(X11_Xext_LIB)
|
||||||
SET(CMAKE_X_LIBS ${CMAKE_X_LIBS} ${CMAKE_Xext_LIB})
|
SET(X11_LIBRARIES ${X11_LIBRARIES} ${X11_Xext_LIB})
|
||||||
ENDIF(CMAKE_Xext_LIB)
|
ENDIF(X11_Xext_LIB)
|
||||||
|
|
||||||
# Deprecated variable for backwards compatibility with CMake 1.4
|
# Deprecated variable for backwards compatibility with CMake 1.4
|
||||||
IF(CMAKE_X11_INCLUDE_PATH)
|
IF(X11_X11_INCLUDE_PATH)
|
||||||
IF(CMAKE_X_LIBS)
|
IF(X11_LIBRARIES)
|
||||||
SET(CMAKE_HAS_X 1)
|
SET(X11_FOUND 1)
|
||||||
ENDIF(CMAKE_X_LIBS)
|
ENDIF(X11_LIBRARIES)
|
||||||
ENDIF(CMAKE_X11_INCLUDE_PATH)
|
ENDIF(X11_X11_INCLUDE_PATH)
|
||||||
|
|
||||||
IF(CMAKE_HAS_X)
|
IF(X11_FOUND)
|
||||||
INCLUDE(${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake)
|
INCLUDE(${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake)
|
||||||
INCLUDE(${CMAKE_ROOT}/Modules/CheckLibraryExists.cmake)
|
INCLUDE(${CMAKE_ROOT}/Modules/CheckLibraryExists.cmake)
|
||||||
|
|
||||||
# Translated from an autoconf-generated configure script.
|
# Translated from an autoconf-generated configure script.
|
||||||
# See libs.m4 in autoconf's m4 directory.
|
# See libs.m4 in autoconf's m4 directory.
|
||||||
IF($ENV{ISC} MATCHES "^yes$")
|
IF($ENV{ISC} MATCHES "^yes$")
|
||||||
SET(CMAKE_X_EXTRA_LIBS -lnsl_s -linet)
|
SET(X11_X_EXTRA_LIBS -lnsl_s -linet)
|
||||||
ELSE($ENV{ISC} MATCHES "^yes$")
|
ELSE($ENV{ISC} MATCHES "^yes$")
|
||||||
SET(CMAKE_X_EXTRA_LIBS "")
|
SET(X11_X_EXTRA_LIBS "")
|
||||||
|
|
||||||
# See if XOpenDisplay in X11 works by itself.
|
# See if XOpenDisplay in X11 works by itself.
|
||||||
CHECK_LIBRARY_EXISTS("${CMAKE_X_LIBS}" "XOpenDisplay" "" CMAKE_LIB_X11_SOLO)
|
CHECK_LIBRARY_EXISTS("${X11_LIBRARIES}" "XOpenDisplay" "" X11_LIB_X11_SOLO)
|
||||||
IF(NOT CMAKE_LIB_X11_SOLO)
|
IF(NOT X11_LIB_X11_SOLO)
|
||||||
# Find library needed for dnet_ntoa.
|
# Find library needed for dnet_ntoa.
|
||||||
CHECK_LIBRARY_EXISTS("dnet" "dnet_ntoa" "" CMAKE_LIB_DNET_HAS_DNET_NTOA)
|
CHECK_LIBRARY_EXISTS("dnet" "dnet_ntoa" "" X11_LIB_DNET_HAS_DNET_NTOA)
|
||||||
IF (CMAKE_LIB_DNET_HAS_DNET_NTOA)
|
IF (X11_LIB_DNET_HAS_DNET_NTOA)
|
||||||
SET (CMAKE_X_EXTRA_LIBS ${CMAKE_X_EXTRA_LIBS} -ldnet)
|
SET (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -ldnet)
|
||||||
ELSE (CMAKE_LIB_DNET_HAS_DNET_NTOA)
|
ELSE (X11_LIB_DNET_HAS_DNET_NTOA)
|
||||||
CHECK_LIBRARY_EXISTS("dnet_stub" "dnet_ntoa" "" CMAKE_LIB_DNET_STUB_HAS_DNET_NTOA)
|
CHECK_LIBRARY_EXISTS("dnet_stub" "dnet_ntoa" "" X11_LIB_DNET_STUB_HAS_DNET_NTOA)
|
||||||
IF (CMAKE_LIB_DNET_STUB_HAS_DNET_NTOA)
|
IF (X11_LIB_DNET_STUB_HAS_DNET_NTOA)
|
||||||
SET (CMAKE_X_EXTRA_LIBS ${CMAKE_X_EXTRA_LIBS} -ldnet_stub)
|
SET (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -ldnet_stub)
|
||||||
ENDIF (CMAKE_LIB_DNET_STUB_HAS_DNET_NTOA)
|
ENDIF (X11_LIB_DNET_STUB_HAS_DNET_NTOA)
|
||||||
ENDIF (CMAKE_LIB_DNET_HAS_DNET_NTOA)
|
ENDIF (X11_LIB_DNET_HAS_DNET_NTOA)
|
||||||
ENDIF(NOT CMAKE_LIB_X11_SOLO)
|
ENDIF(NOT X11_LIB_X11_SOLO)
|
||||||
|
|
||||||
# Find library needed for gethostbyname.
|
# Find library needed for gethostbyname.
|
||||||
CHECK_FUNCTION_EXISTS("gethostbyname" CMAKE_HAVE_GETHOSTBYNAME)
|
CHECK_FUNCTION_EXISTS("gethostbyname" CMAKE_HAVE_GETHOSTBYNAME)
|
||||||
|
@ -94,7 +94,7 @@ IF (UNIX)
|
||||||
ELSE (CMAKE_LIB_NSL_HAS_GETHOSTBYNAME)
|
ELSE (CMAKE_LIB_NSL_HAS_GETHOSTBYNAME)
|
||||||
CHECK_LIBRARY_EXISTS("bsd" "gethostbyname" "" CMAKE_LIB_BSD_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 (CMAKE_X_EXTRA_LIBS ${CMAKE_X_EXTRA_LIBS} -lbsd)
|
SET (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -lbsd)
|
||||||
ENDIF (CMAKE_LIB_BSD_HAS_GETHOSTBYNAME)
|
ENDIF (CMAKE_LIB_BSD_HAS_GETHOSTBYNAME)
|
||||||
ENDIF (CMAKE_LIB_NSL_HAS_GETHOSTBYNAME)
|
ENDIF (CMAKE_LIB_NSL_HAS_GETHOSTBYNAME)
|
||||||
ENDIF(NOT CMAKE_HAVE_GETHOSTBYNAME)
|
ENDIF(NOT CMAKE_HAVE_GETHOSTBYNAME)
|
||||||
|
@ -104,7 +104,7 @@ IF (UNIX)
|
||||||
IF(NOT CMAKE_HAVE_CONNECT)
|
IF(NOT CMAKE_HAVE_CONNECT)
|
||||||
CHECK_LIBRARY_EXISTS("socket" "connect" "" CMAKE_LIB_SOCKET_HAS_CONNECT)
|
CHECK_LIBRARY_EXISTS("socket" "connect" "" CMAKE_LIB_SOCKET_HAS_CONNECT)
|
||||||
IF (CMAKE_LIB_SOCKET_HAS_CONNECT)
|
IF (CMAKE_LIB_SOCKET_HAS_CONNECT)
|
||||||
SET (CMAKE_X_EXTRA_LIBS -lsocket ${CMAKE_X_EXTRA_LIBS})
|
SET (X11_X_EXTRA_LIBS -lsocket ${X11_X_EXTRA_LIBS})
|
||||||
ENDIF (CMAKE_LIB_SOCKET_HAS_CONNECT)
|
ENDIF (CMAKE_LIB_SOCKET_HAS_CONNECT)
|
||||||
ENDIF(NOT CMAKE_HAVE_CONNECT)
|
ENDIF(NOT CMAKE_HAVE_CONNECT)
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ IF (UNIX)
|
||||||
IF(NOT CMAKE_HAVE_REMOVE)
|
IF(NOT CMAKE_HAVE_REMOVE)
|
||||||
CHECK_LIBRARY_EXISTS("posix" "remove" "" CMAKE_LIB_POSIX_HAS_REMOVE)
|
CHECK_LIBRARY_EXISTS("posix" "remove" "" CMAKE_LIB_POSIX_HAS_REMOVE)
|
||||||
IF (CMAKE_LIB_POSIX_HAS_REMOVE)
|
IF (CMAKE_LIB_POSIX_HAS_REMOVE)
|
||||||
SET (CMAKE_X_EXTRA_LIBS ${CMAKE_X_EXTRA_LIBS} -lposix)
|
SET (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -lposix)
|
||||||
ENDIF (CMAKE_LIB_POSIX_HAS_REMOVE)
|
ENDIF (CMAKE_LIB_POSIX_HAS_REMOVE)
|
||||||
ENDIF(NOT CMAKE_HAVE_REMOVE)
|
ENDIF(NOT CMAKE_HAVE_REMOVE)
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ IF (UNIX)
|
||||||
IF(NOT CMAKE_HAVE_SHMAT)
|
IF(NOT CMAKE_HAVE_SHMAT)
|
||||||
CHECK_LIBRARY_EXISTS("ipc" "shmat" "" CMAKE_LIB_IPS_HAS_SHMAT)
|
CHECK_LIBRARY_EXISTS("ipc" "shmat" "" CMAKE_LIB_IPS_HAS_SHMAT)
|
||||||
IF (CMAKE_LIB_IPS_HAS_SHMAT)
|
IF (CMAKE_LIB_IPS_HAS_SHMAT)
|
||||||
SET (CMAKE_X_EXTRA_LIBS ${CMAKE_X_EXTRA_LIBS} -lipc)
|
SET (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -lipc)
|
||||||
ENDIF (CMAKE_LIB_IPS_HAS_SHMAT)
|
ENDIF (CMAKE_LIB_IPS_HAS_SHMAT)
|
||||||
ENDIF(NOT CMAKE_HAVE_SHMAT)
|
ENDIF(NOT CMAKE_HAVE_SHMAT)
|
||||||
ENDIF($ENV{ISC} MATCHES "^yes$")
|
ENDIF($ENV{ISC} MATCHES "^yes$")
|
||||||
|
@ -130,20 +130,20 @@ IF (UNIX)
|
||||||
CHECK_LIBRARY_EXISTS("ICE" "IceConnectionNumber" ""
|
CHECK_LIBRARY_EXISTS("ICE" "IceConnectionNumber" ""
|
||||||
CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER)
|
CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER)
|
||||||
IF(CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER)
|
IF(CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER)
|
||||||
SET (CMAKE_X_PRE_LIBS -lSM -lICE)
|
SET (X11_X_PRE_LIBS -lSM -lICE)
|
||||||
ENDIF(CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER)
|
ENDIF(CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER)
|
||||||
|
|
||||||
# Build the final list of libraries.
|
# Build the final list of libraries.
|
||||||
SET (CMAKE_X_LIBS ${CMAKE_X_PRE_LIBS} ${CMAKE_X_LIBS} ${CMAKE_X_EXTRA_LIBS})
|
SET (X11_LIBRARIES ${X11_X_PRE_LIBS} ${X11_LIBRARIES} ${X11_X_EXTRA_LIBS})
|
||||||
ENDIF(CMAKE_HAS_X)
|
ENDIF(X11_FOUND)
|
||||||
|
|
||||||
MARK_AS_ADVANCED(
|
MARK_AS_ADVANCED(
|
||||||
CMAKE_X11_INCLUDE_PATH
|
X11_X11_INCLUDE_PATH
|
||||||
CMAKE_X11_LIB
|
X11_X11_LIB
|
||||||
CMAKE_Xext_LIB
|
X11_Xext_LIB
|
||||||
CMAKE_Xlib_INCLUDE_PATH
|
X11_Xlib_INCLUDE_PATH
|
||||||
CMAKE_Xutil_INCLUDE_PATH
|
X11_Xutil_INCLUDE_PATH
|
||||||
CMAKE_X_LIBS
|
X11_LIBRARIES
|
||||||
)
|
)
|
||||||
|
|
||||||
ENDIF (UNIX)
|
ENDIF (UNIX)
|
||||||
|
|
Loading…
Reference in New Issue