chore(cmake): improve Xext lookup for systems other than Linux

master
David CARLIER 2022-08-13 16:25:23 +01:00 committed by GitHub
parent 0f2db9e5ef
commit 282c7ae031
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 1 deletions

View File

@ -91,6 +91,10 @@ else()
if(NOT OpusFile_FOUND)
message(FATAL_ERROR "libopus/libopusfile not found, please install it (and make sure it's in your path)")
endif()
include(cmake/FindXext.cmake)
if(NOT XEXT_FOUND)
message(FATAL_ERROR "libXext, please install it (and make sure it's in your path)")
endif()
endif()

View File

@ -140,7 +140,8 @@ endif()
if(WIN32)
target_link_libraries(OpenSpades ws2_32.lib winmm.lib)
elseif(UNIX AND NOT APPLE)
target_link_libraries(OpenSpades Xext)
target_link_libraries(OpenSpades ${XEXT_LIBRARY})
include_directories(${XEXT_INCLUDE_DIR})
endif()
if(UNIX)

25
cmake/FindXext.cmake Normal file
View File

@ -0,0 +1,25 @@
FIND_PATH(XEXT_INCLUDE_DIR NAMES X11/extensions/Xext.h
/usr/include
/usr/local/include
/sw/include
/opt/local/include
DOC "The directory where Xext.h resides")
FIND_LIBRARY( XEXT_LIBRARY
NAMES XEXT Xext
PATHS
/usr/lib64
/usr/lib
/usr/local/lib64
/usr/local/lib
/sw/lib
/opt/local/lib
DOC "The Xext library")
IF (XEXT_INCLUDE_DIR)
SET( XEXT_FOUND 1 CACHE STRING "Set to 1 if XEXT is found, 0 otherwise")
ELSE (XEXT_INCLUDE_DIR)
SET( XEXT_FOUND 0 CACHE STRING "Set to 1 if XEXT is found, 0 otherwise")
ENDIF (XEXT_INCLUDE_DIR)
MARK_AS_ADVANCED( XEXT_FOUND )