summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Golubev <fatzer2@gmail.com>2024-02-03 11:47:04 +0300
committerMichele Calgaro <michele.calgaro@yahoo.it>2024-02-07 18:22:03 +0900
commit75d69350ab57f01e296cd0672188c1a453cf75dc (patch)
treefabf899100cd64a72cd7f4ce1122a6fb732d74a4
parentaaf98109d9c1522d8c3e6ca13b95e12fae853fe6 (diff)
downloadlibr-75d69350ab57f01e296cd0672188c1a453cf75dc.tar.gz
libr-75d69350ab57f01e296cd0672188c1a453cf75dc.zip
Make dependency upon gtk optional
Signed-off-by: Alexander Golubev <fatzer2@gmail.com> (cherry picked from commit c3ef8bdc0d7a325c8ece072a2c38d1dbc290adb5)
-rw-r--r--CMakeLists.txt20
-rw-r--r--src/CMakeLists.txt10
2 files changed, 21 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 97ca9fd..8c5246c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -46,10 +46,14 @@ tde_setup_paths( )
##### optional stuff ############################
-option( WITH_BACKEND_LIBBFD "Build with libbfd backend" "ON" )
-option( WITH_BACKEND_LIBELF "Build with libelf backend" "OFF" )
-option( WITH_BACKEND_READONLY "Build with read-only backend" "OFF" )
+option( WITH_BACKEND_LIBBFD "Build with libbfd backend" ON )
+option( WITH_BACKEND_LIBELF "Build with libelf backend" OFF )
+option( WITH_BACKEND_READONLY "Build with read-only backend" OFF )
+option( WITH_GTK "Build support for GTK" ON )
+# NOTE: WITH_GTK build gtk bindings to ease libr in gtk applications.
+# It uses weak linkage, so gtk will be required during build
+# only and not strictly necessary during runtime.
#### configure checks ###########################
@@ -95,10 +99,12 @@ if( NOT ZLIB_FOUND )
tde_message_fatal( "zlib are required, but not found on your system" )
endif( NOT ZLIB_FOUND )
-pkg_search_module( GTK gtk+-2.0 )
-if( NOT GTK_FOUND )
- tde_message_fatal( "gtk2 is required but was not found on your system" )
-endif( )
+if( WITH_GTK )
+ pkg_search_module( GTK gtk+-2.0 )
+ if( NOT GTK_FOUND )
+ tde_message_fatal( "gtk2 is required but was not found on your system" )
+ endif( )
+endif( WITH_GTK )
set( DL_LIBRARIES dl )
check_library_exists( ${DL_LIBRARIES} dlopen /lib HAVE_LIBDL )
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 9026ea2..272d74c 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -34,10 +34,13 @@ set( ${target}_SRCS
onecanvas.c
libr-icons.c
libr-i18n.c
- libr-gtk.c
libr.c
)
+if( WITH_GTK )
+ list( APPEND ${target}_SRCS libr-gtk.c )
+endif( WITH_GTK )
+
tde_add_library(
${target} SHARED
VERSION 1.0.0
@@ -61,10 +64,13 @@ set( ${target}_INCLUDES
gettext.h
libr-icons.h
libr-i18n.h
- libr-gtk.h
libr.h
)
+if( WITH_GTK )
+ list( APPEND ${target}_INCLUDES libr-gtk.h )
+endif( WITH_GTK )
+
install(
FILES ${${target}_INCLUDES}
DESTINATION ${INCLUDE_INSTALL_DIR}/libr