From 42ecd0fb3228f1256c2a84e0c3aaefcae61a8b21 Mon Sep 17 00:00:00 2001
From: Alfred Wingate <parona@protonmail.com>
Date: Thu, 3 Jul 2025 17:07:30 +0300
Subject: [PATCH] Add buildtime switch to control libsecret support

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -61,6 +61,7 @@ option (WITH_AQBANKING "Build this project with aqbanking (online banking and a
 option (WITH_GNUCASH "Build all of GnuCash, not just the library" ON)
 option (WITH_OFX "compile with ofx support (needs LibOFX)" ON)
 option (WITH_PYTHON "enable python plugin and bindings" OFF)
+option (WITH_LIBSECRET "enable support for libsecret" OFF)
 option (ENABLE_BINRELOC "compile with binary relocation support" ON)
 option (DISABLE_NLS "do not use Native Language Support" OFF)
 option (COVERAGE "Instrument a Debug or Asan build for coverage reporting" OFF)
@@ -564,10 +565,13 @@ find_program(POD2MAN_EXECUTABLE pod2man HINTS ${PERL_DIR})
 #ICU
 find_package(ICU 54.0 REQUIRED COMPONENTS uc i18n)
 
-pkg_check_modules (LIBSECRET libsecret-1>=0.18)
-IF (LIBSECRET_FOUND)
+IF (WITH_LIBSECRET)
+  pkg_check_modules (LIBSECRET libsecret-1>=0.18)
+  IF (NOT LIBSECRET_FOUND)
+    message(SEND_ERROR "libsecret support enabled, but libsecret not found.")
+  ENDIF (LIBSECRET_FOUND)
   SET (HAVE_LIBSECRET ON)
-ENDIF (LIBSECRET_FOUND)
+ENDIF (WITH_LIBSECRET)
 
 #BOOST
 set (Boost_USE_MULTITHREADED ON)
-- 
2.50.0

