diff options
author | Silvan Mosberger <contact@infinisil.com> | 2023-12-11 17:45:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-11 17:45:22 +0100 |
commit | 5812c533eddfc767c9987f745cf111275cb3ed89 (patch) | |
tree | 4ed760efcbf0ab3cb13fba6ab8537dd017a2915d /lib | |
parent | a9bf124c46ef298113270b1f84a164865987a91c (diff) | |
parent | 2d478748209f7dfb932eeabdd2378af012f08457 (diff) | |
download | nixlib-5812c533eddfc767c9987f745cf111275cb3ed89.tar nixlib-5812c533eddfc767c9987f745cf111275cb3ed89.tar.gz nixlib-5812c533eddfc767c9987f745cf111275cb3ed89.tar.bz2 nixlib-5812c533eddfc767c9987f745cf111275cb3ed89.tar.lz nixlib-5812c533eddfc767c9987f745cf111275cb3ed89.tar.xz nixlib-5812c533eddfc767c9987f745cf111275cb3ed89.tar.zst nixlib-5812c533eddfc767c9987f745cf111275cb3ed89.zip |
Merge pull request #273474 from adisbladis/lib-cmakeOptionType-static-list
lib.cmakeOptionType: Statically compute types list
Diffstat (limited to 'lib')
-rw-r--r-- | lib/strings.nix | 13 |
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. |