mirror of
https://github.com/SFML/SFML.git
synced 2024-11-28 22:31:09 +08:00
Use X11's find module
Added in CMake 3.14 so this wasn't accessible in prior versions of SFML
This commit is contained in:
parent
938e90b7d2
commit
eb162df723
@ -1,5 +1,7 @@
|
|||||||
# in case of static linking, we must also define the list of all the dependencies of SFML libraries
|
# in case of static linking, we must also define the list of all the dependencies of SFML libraries
|
||||||
if(SFML_STATIC_LIBRARIES)
|
if(SFML_STATIC_LIBRARIES)
|
||||||
|
include(CMakeFindDependencyMacro)
|
||||||
|
|
||||||
# detect the OS
|
# detect the OS
|
||||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
||||||
set(FIND_SFML_OS_WINDOWS 1)
|
set(FIND_SFML_OS_WINDOWS 1)
|
||||||
@ -40,9 +42,7 @@ if(SFML_STATIC_LIBRARIES)
|
|||||||
list(FIND SFML_FIND_COMPONENTS "Window" FIND_SFML_WINDOW_COMPONENT_INDEX)
|
list(FIND SFML_FIND_COMPONENTS "Window" FIND_SFML_WINDOW_COMPONENT_INDEX)
|
||||||
if(FIND_SFML_WINDOW_COMPONENT_INDEX GREATER -1)
|
if(FIND_SFML_WINDOW_COMPONENT_INDEX GREATER -1)
|
||||||
if(FIND_SFML_OS_LINUX OR FIND_SFML_OS_FREEBSD)
|
if(FIND_SFML_OS_LINUX OR FIND_SFML_OS_FREEBSD)
|
||||||
sfml_bind_dependency(TARGET X11 FRIENDLY_NAME "X11" SEARCH_NAMES "X11")
|
find_dependency(X11)
|
||||||
sfml_bind_dependency(TARGET X11 FRIENDLY_NAME "Xrandr" SEARCH_NAMES "Xrandr")
|
|
||||||
sfml_bind_dependency(TARGET X11 FRIENDLY_NAME "Xcursor" SEARCH_NAMES "Xcursor")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(FIND_SFML_OS_LINUX)
|
if(FIND_SFML_OS_LINUX)
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
|
find_package(X11 REQUIRED)
|
||||||
|
|
||||||
# all source files
|
# all source files
|
||||||
set(SRC X11.cpp)
|
set(SRC X11.cpp)
|
||||||
|
|
||||||
# define the X11 target
|
# define the X11 target
|
||||||
sfml_add_example(X11Example GUI_APP
|
sfml_add_example(X11Example GUI_APP
|
||||||
SOURCES ${SRC}
|
SOURCES ${SRC}
|
||||||
DEPENDS SFML::Window X11)
|
DEPENDS SFML::Window X11::X11)
|
||||||
|
|
||||||
# external dependency headers
|
# external dependency headers
|
||||||
target_include_directories(X11Example SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/examples/include)
|
target_include_directories(X11Example SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/examples/include)
|
||||||
|
@ -285,8 +285,8 @@ if(SFML_OS_LINUX OR SFML_OS_FREEBSD OR SFML_OS_OPENBSD OR SFML_OS_NETBSD)
|
|||||||
sfml_find_package(GBM INCLUDE "GBM_INCLUDE_DIR" LINK "GBM_LIBRARY")
|
sfml_find_package(GBM INCLUDE "GBM_INCLUDE_DIR" LINK "GBM_LIBRARY")
|
||||||
target_link_libraries(sfml-window PRIVATE drm gbm EGL)
|
target_link_libraries(sfml-window PRIVATE drm gbm EGL)
|
||||||
else()
|
else()
|
||||||
sfml_find_package(X11 INCLUDE "X11_INCLUDE_DIR" LINK "X11_X11_LIB" "X11_Xrandr_LIB" "X11_Xcursor_LIB")
|
find_package(X11 REQUIRED)
|
||||||
target_link_libraries(sfml-window PRIVATE X11)
|
target_link_libraries(sfml-window PRIVATE X11::X11 X11::Xrandr X11::Xcursor)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
target_link_libraries(sfml-window PUBLIC SFML::System)
|
target_link_libraries(sfml-window PUBLIC SFML::System)
|
||||||
|
Loading…
Reference in New Issue
Block a user