Skip to content

Commit

Permalink
TGUIConfig.cmake could be invalid when X11 wasn't used as extra depen…
Browse files Browse the repository at this point in the history
…dency
  • Loading branch information
texus committed Jul 23, 2024
1 parent eb42ddf commit 8dac59a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions cmake/Dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,7 @@ macro(tgui_add_dependency_x11)
message(FATAL_ERROR "X11 isn't supported on this platform")
endif()

unset(TGUI_USE_X11) # We had it set to FALSE in case we never add X11 as a dependency and don't get here
tgui_set_option(TGUI_USE_X11 TRUE BOOL "Set to FALSE if you don't want to link to X11. Note that doing so will prevent some mouse cursors from showing correctly.")
mark_as_advanced(TGUI_USE_X11)

Expand Down
2 changes: 1 addition & 1 deletion src/Backend/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ endif()
if(TGUI_HAS_WINDOW_BACKEND_RAYLIB OR TGUI_HAS_RENDERER_BACKEND_RAYLIB OR TGUI_HAS_FONT_BACKEND_RAYLIB)
tgui_add_dependency_raylib()
endif()
if(TGUI_OS_LINUX OR TGUI_OS_BSD)
if(TGUI_OS_LINUX)
# We need X11 to display diagonal arrow mouse cursors if we use a window from SFML < 2.6 or SDL < 3
if((TGUI_HAS_WINDOW_BACKEND_SFML AND SFML_VERSION VERSION_LESS "2.6") OR (TGUI_HAS_WINDOW_BACKEND_SDL AND NOT TGUI_USE_SDL3))
tgui_add_dependency_x11()
Expand Down
3 changes: 3 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,9 @@ if(TGUI_OS_LINUX)
find_package(Threads REQUIRED)
target_link_libraries(tgui PRIVATE Threads::Threads)
target_link_libraries(tgui PRIVATE ${CMAKE_DL_LIBS})

# The TGUI_USE_X11 variable must always exist on linux to generate a valid TGUIConfig.cmake file
set(TGUI_USE_X11 OFF)
endif()

add_library(TGUI::TGUI ALIAS tgui)
Expand Down

0 comments on commit 8dac59a

Please sign in to comment.