Unverified Commit 6dadef67 authored by Sebastián Mancilla's avatar Sebastián Mancilla Committed by GitHub
Browse files

lastpass-cli: fix build failure with cmake 4 (#452443)

parents 6031bcfc 02f23214
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
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)
+9 −0
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@
  curl,
  libxml2,
  libxslt,
  fetchpatch,
}:

stdenv.mkDerivation rec {
@@ -44,6 +45,14 @@ stdenv.mkDerivation rec {
    "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 = ''
    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