lastpass-cli: fix build failure with cmake 4

- CMake 4 is no longer retro compatible with versions < 3.5
This commit is contained in:
Clément
2025-10-15 18:15:26 -07:00
parent 71bc8fd56a
commit 02f2321446
2 changed files with 36 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
From 31a4ad5f735933ff8e96403103d5b4f61faee945 Mon Sep 17 00:00:00 2001
From: Yaksh Bariya <yakshbari4@gmail.com>
Date: Wed, 11 Jun 2025 06:37:27 +0530
Subject: [PATCH] fix builds with cmake 4.x
---
CMakeLists.txt | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index efc6ba0..cd693f4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,8 +1,10 @@
-if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_LESS 3.1)
+if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_GREATER_EQUAL 4.0)
+ cmake_minimum_required(VERSION 4.0)
+elseif(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_GREATER_EQUAL 3.1)
+ cmake_minimum_required(VERSION 3.1)
+else()
set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake > 2.8.4 is required
cmake_minimum_required(VERSION 2.8)
-else()
- cmake_minimum_required(VERSION 3.1)
endif()
project(lpass)

View File

@@ -11,6 +11,7 @@
curl, curl,
libxml2, libxml2,
libxslt, libxslt,
fetchpatch,
}: }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
@@ -44,6 +45,14 @@ stdenv.mkDerivation rec {
"install-doc" "install-doc"
]; ];
patches = [
# CMake 3.1 is deprecated and no longer supported by CMake > 4
# https://github.com/NixOS/nixpkgs/issues/445447
# The patch comes from https://github.com/lastpass/lastpass-cli/pull/716 while
# it is not merged and integrated in a new release.
./716-bump-cmake-minimum-version.patch
];
postInstall = '' postInstall = ''
install -Dm644 -T ../contrib/lpass_zsh_completion $out/share/zsh/site-functions/_lpass install -Dm644 -T ../contrib/lpass_zsh_completion $out/share/zsh/site-functions/_lpass
install -Dm644 -T ../contrib/completions-lpass.fish $out/share/fish/vendor_completions.d/lpass.fish install -Dm644 -T ../contrib/completions-lpass.fish $out/share/fish/vendor_completions.d/lpass.fish