diff --git a/CMakeLists.txt b/CMakeLists.txt index 2c35e326..a16a6d27 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() diff --git a/Sources/CMakeLists.txt b/Sources/CMakeLists.txt index 3483553d..1304bf02 100644 --- a/Sources/CMakeLists.txt +++ b/Sources/CMakeLists.txt @@ -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) diff --git a/cmake/FindXext.cmake b/cmake/FindXext.cmake new file mode 100644 index 00000000..802deb59 --- /dev/null +++ b/cmake/FindXext.cmake @@ -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 )