about summary refs log tree commit diff
path: root/pkgs/by-name/cm
diff options
context:
space:
mode:
authorAnderson Torres <torres.anderson.85@protonmail.com>2023-10-16 11:08:11 -0300
committerAnderson Torres <torres.anderson.85@protonmail.com>2023-10-28 23:38:57 -0300
commit9f4436aa8c016a14d8969200d2c2083b3b4522a0 (patch)
treef19e721019a8f386aec2d59e192ef043c249531b /pkgs/by-name/cm
parent0f4bc8579f1f2c04f62fa625ed07663c22532a12 (diff)
cmake: use lib.cmake* functions
Also, a bit of cosmetic rewriting.
Diffstat (limited to 'pkgs/by-name/cm')
-rw-r--r--pkgs/by-name/cm/cmake/package.nix28
1 files changed, 15 insertions, 13 deletions
diff --git a/pkgs/by-name/cm/cmake/package.nix b/pkgs/by-name/cm/cmake/package.nix
index 00715130a000d..bba4bfc7afb88 100644
--- a/pkgs/by-name/cm/cmake/package.nix
+++ b/pkgs/by-name/cm/cmake/package.nix
@@ -4,8 +4,10 @@
 , buildPackages
 , bzip2
 , curlMinimal
+, darwin
 , expat
 , libarchive
+, libsForQt5
 , libuv
 , ncurses
 , openssl
@@ -16,13 +18,11 @@
 , texinfo
 , xz
 , zlib
+, buildDocs ? !(isBootstrap || (uiToolkits == []))
 , isBootstrap ? false
+, uiToolkits ? [] # can contain "ncurses" and/or "qt5"
 , useOpenSSL ? !isBootstrap
 , useSharedLibraries ? (!isBootstrap && !stdenv.isCygwin)
-, uiToolkits ? [] # can contain "ncurses" and/or "qt5"
-, buildDocs ? !(isBootstrap || (uiToolkits == []))
-, darwin
-, libsForQt5
 }:
 
 let
@@ -129,15 +129,17 @@ stdenv.mkDerivation (finalAttrs: {
     # Unfortunately cmake seems to expect absolute paths for ar, ranlib, and
     # strip. Otherwise they are taken to be relative to the source root of the
     # package being built.
-    "-DCMAKE_CXX_COMPILER=${stdenv.cc.targetPrefix}c++"
-    "-DCMAKE_C_COMPILER=${stdenv.cc.targetPrefix}cc"
-    "-DCMAKE_AR=${lib.getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}ar"
-    "-DCMAKE_RANLIB=${lib.getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}ranlib"
-    "-DCMAKE_STRIP=${lib.getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}strip"
-
-    "-DCMAKE_USE_OPENSSL=${if useOpenSSL then "ON" else "OFF"}"
-    # Avoid depending on frameworks.
-    "-DBUILD_CursesDialog=${if cursesUI then "ON" else "OFF"}"
+    (lib.cmakeFeature "CMAKE_CXX_COMPILER" "${stdenv.cc.targetPrefix}c++")
+    (lib.cmakeFeature "CMAKE_C_COMPILER" "${stdenv.cc.targetPrefix}cc")
+    (lib.cmakeFeature "CMAKE_AR"
+      "${lib.getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}ar")
+    (lib.cmakeFeature "CMAKE_RANLIB"
+      "${lib.getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}ranlib")
+    (lib.cmakeFeature "CMAKE_STRIP"
+      "${lib.getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}strip")
+
+    (lib.cmakeBool "CMAKE_USE_OPENSSL" useOpenSSL)
+    (lib.cmakeBool "BUILD_CursesDialog" cursesUI)
   ];
 
   # make install attempts to use the just-built cmake