cmakeFlags and spaces in option values

cmakeFlags are currently passed to CMake as follows:

so Bash will tokenize them on spaces and there is no way to prevent it.

The only alternative is adding the flag to cmakeFlagsArray in a Bash code. For example:

preConfigure = ''
  cmakeFlagsArray+=(
    "-DSOMELIB_CXX_FLAGS=\"-O3 -march=native\""
  )
'';

In the future, this might be possible from Nix through __structuredAttrs.

2 Likes