1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

Add explicit cmake setting for 'build without GTK'.

If you have GTK installed on your system but want to build without it
anyway (e.g. if you're buliding a package suitable for headless
systems), it's useful to be able to explicitly instruct PuTTY's build
system not to use GTK even if it's there.

This would already work if you unilaterally set PUTTY_GTK_VERSION to
some value other than 1, 2, 3 or ANY. Added NONE as an officially
supported option, and included it in the list that cmake-gui will
present.

Also, made the check for libX11 conditional on having GTK, since
there's no need to bother with it otherwise.
This commit is contained in:
Simon Tatham 2022-09-18 15:02:32 +01:00
parent a95e38e9b1
commit 732ec31a17
2 changed files with 16 additions and 14 deletions

View File

@ -3,7 +3,7 @@
set(PUTTY_GTK_VERSION "ANY"
CACHE STRING "Which major version of GTK to build with")
set_property(CACHE PUTTY_GTK_VERSION
PROPERTY STRINGS ANY 3 2 1)
PROPERTY STRINGS ANY 3 2 1 NONE)
set(GTK_FOUND FALSE)

View File

@ -65,21 +65,23 @@ endif()
include(cmake/gtk.cmake)
# See if we have X11 available. This requires libX11 itself, and also
# the GDK integration to X11.
find_package(X11)
if(GTK_FOUND)
# See if we have X11 available. This requires libX11 itself, and also
# the GDK integration to X11.
find_package(X11)
function(check_x11)
list(APPEND CMAKE_REQUIRED_INCLUDES ${GTK_INCLUDE_DIRS})
check_include_file(gdk/gdkx.h HAVE_GDK_GDKX_H)
function(check_x11)
list(APPEND CMAKE_REQUIRED_INCLUDES ${GTK_INCLUDE_DIRS})
check_include_file(gdk/gdkx.h HAVE_GDK_GDKX_H)
if(X11_FOUND AND HAVE_GDK_GDKX_H)
set(NOT_X_WINDOWS OFF PARENT_SCOPE)
else()
set(NOT_X_WINDOWS ON PARENT_SCOPE)
endif()
endfunction()
check_x11()
if(X11_FOUND AND HAVE_GDK_GDKX_H)
set(NOT_X_WINDOWS OFF PARENT_SCOPE)
else()
set(NOT_X_WINDOWS ON PARENT_SCOPE)
endif()
endfunction()
check_x11()
endif()
include_directories(${CMAKE_SOURCE_DIR}/charset ${GTK_INCLUDE_DIRS} ${X11_INCLUDE_DIR})
link_directories(${GTK_LIBRARY_DIRS})