Skip to content

cmakeFlags cannot parse spaces #114044

@IvarWithoutBones

Description

@IvarWithoutBones

Describe the bug
The cmakeFlags array cannot parse spaces correctly, and thinks any argument after a space is a another CMake flag. I think it splits the flag on spaces upon parsing it. The flags do get printed out correctly, however they are not handled the same way.

I've tried using all kinds of different quotes, and escaping almost every single character, but nothing seemed to work.

To Reproduce
Steps to reproduce the behavior:

  1. Append an space to a CMake flag. (cmakeFlags = [ "-DFoo=\"foo bar\"" ];)
  2. Watch the cmakeConfigurePhase fail, as it thinks bar is an seperate flag, and it cannot find this local file.
    CMake Error: The source directory "/build/source/build/bar"" does not exist.

Expected behavior
cmakeFlags should be correctly passed to CMake, and the build should succeed.

Additional context
Note that when manually setting cmakeFlagsArray, this does work.

  preConfigure = ''
    cmakeFlagsArray=(
      $cmakeFlagsArray
      "-DFoo=\"foo bar\""
    )
  '';

When applying this flag from a nix-shell, it also succesfully parses it.

Notify maintainers
@ttuegel @LnL7

Metadata

  • system: "x86_64-linux"
  • host os: Linux 5.11.0, NixOS, 21.05pre271444.9816b99e71c (Okapi)
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.3.10
  • channels(root): "nixos-21.05pre271444.9816b99e71c"
  • channels(ivv): "home-manager, nixpkgs-21.05pre271900.11cd34cd592"
  • nixpkgs: /home/ivv/.nix-defexpr/channels/nixpkgs

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute: cmake
attribute: yuzu-{mainline,ea}

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: bugSomething is broken1.severity: significantNovel ideas, large API changes, notable refactorings, issues with RFC potential, etc.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions