Remove useless X11 libraries when building with -DFLTK_BACKEND_X11=0

This commit is contained in:
ManoloFLTK 2024-03-13 14:57:38 +01:00
parent 69df45d38b
commit 3fafeb9ea1
2 changed files with 8 additions and 9 deletions

View File

@ -287,7 +287,9 @@ if(UNIX)
if(FLTK_BACKEND_WAYLAND)
set(FLTK_USE_WAYLAND 1)
include(FindX11)
if(FLTK_BACKEND_X11)
include(FindX11)
endif()
if(FLTK_BACKEND_X11 AND X11_FOUND)
set(FLTK_USE_X11 1) # build a hybrid Wayland/X11 library
else()
@ -299,7 +301,7 @@ if(UNIX)
set(USE_SYSTEM_LIBDECOR 1)
unset(FLTK_USE_XRENDER CACHE)
unset(FLTK_USE_XINERAMA CACHE)
# unset(FLTK_USE_XFT CACHE)
unset(FLTK_USE_XFT CACHE)
unset(FLTK_USE_XCURSOR CACHE)
unset(FLTK_USE_XFIXES CACHE)
if(X11_FOUND)
@ -860,11 +862,11 @@ if((X11_Xft_FOUND OR NOT USE_PANGOXFT) AND FLTK_USE_PANGO)
list(REMOVE_DUPLICATES FLTK_LDLIBS)
# *FIXME* Libraries should not be added explicitly if possible
if(FLTK_BACKEND_WAYLAND)
if(FLTK_BACKEND_WAYLAND AND FLTK_USE_LIBDECOR_GTK AND NOT USE_SYSTEM_LIBDECOR)
list(APPEND FLTK_LDLIBS -lgtk-3 -lgdk-3 -lgio-2.0)
if(FLTK_BACKEND_X11)
list(APPEND FLTK_LDLIBS -lX11)
endif()
endif()
if(FLTK_BACKEND_X11)
list(APPEND FLTK_LDLIBS -lX11)
endif()
list(REMOVE_DUPLICATES FLTK_LDLIBS)

View File

@ -764,9 +764,6 @@ if(UNIX AND FLTK_BACKEND_WAYLAND)
if(DBUS_FOUND)
list(APPEND OPTIONAL_LIBS "${DBUS_LDFLAGS}")
endif(DBUS_FOUND)
if(NOT FLTK_BACKEND_WAYLAND_ONLY)
list(APPEND OPTIONAL_LIBS "-lXcursor -lXrender -lXinerama -lXfixes -lXft -lXext -lX11")
endif(NOT FLTK_BACKEND_WAYLAND_ONLY)
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux" AND NOT FLTK_BUILD_SHARED_LIBS)
list(APPEND OPTIONAL_LIBS "-no-pie")
endif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux" AND NOT FLTK_BUILD_SHARED_LIBS)