diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake index d4e480c83..263aafc39 100644 --- a/cmake/Dependencies.cmake +++ b/cmake/Dependencies.cmake @@ -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) diff --git a/src/Backend/CMakeLists.txt b/src/Backend/CMakeLists.txt index 7cc9592d4..5ed1d0334 100644 --- a/src/Backend/CMakeLists.txt +++ b/src/Backend/CMakeLists.txt @@ -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() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b50f45749..aaef25643 100755 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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)