summaryrefslogtreecommitdiff
path: root/lib/strings.nix
diff options
context:
space:
mode:
authoradisbladis <adisbladis@gmail.com>2023-12-11 16:45:25 +1300
committeradisbladis <adisbladis@gmail.com>2023-12-11 16:47:22 +1300
commit2d478748209f7dfb932eeabdd2378af012f08457 (patch)
tree2fe4b950323b018b00efaa257258f354cff32fba /lib/strings.nix
parentMerge pull request #273084 from l0b0/fix-web-ext (diff)
downloadnixpkgs-2d478748209f7dfb932eeabdd2378af012f08457.tar.gz
lib.cmakeOptionType: Statically compute types list
Diffstat (limited to 'lib/strings.nix')
-rw-r--r--lib/strings.nix13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/strings.nix b/lib/strings.nix
index 3403f9f32bb6..93247cfcf35e 100644
--- a/lib/strings.nix
+++ b/lib/strings.nix
@@ -771,12 +771,13 @@ rec {
cmakeOptionType "string" "ENGINE" "sdl2"
=> "-DENGINE:STRING=sdl2"
*/
- cmakeOptionType = type: feature: value:
- assert (lib.elem (lib.toUpper type)
- [ "BOOL" "FILEPATH" "PATH" "STRING" "INTERNAL" ]);
- assert (lib.isString feature);
- assert (lib.isString value);
- "-D${feature}:${lib.toUpper type}=${value}";
+ cmakeOptionType = let
+ types = [ "BOOL" "FILEPATH" "PATH" "STRING" "INTERNAL" ];
+ in type: feature: value:
+ assert (elem (toUpper type) types);
+ assert (isString feature);
+ assert (isString value);
+ "-D${feature}:${toUpper type}=${value}";
/* Create a -D<condition>={TRUE,FALSE} string that can be passed to typical
CMake invocations.