<font size=2 face="sans-serif">Hello,</font>
<br>
<br><font size=2 face="sans-serif">the usual way to pass a generator string
to the cmake executable on the command line is:</font>
<br><font size=2 face="sans-serif">        cmake
. -G"Unix Makefiles"</font>
<br>
<br><font size=2 face="sans-serif">But when i have some bash scripting
around it and try to hold the command line arguments in a variable, the
trouble begins...</font>
<br>
<br><font size=2 face="sans-serif">export CMDLINE=". -G\"Unix
Makefiles\"" && cmake $CMDLINE</font>
<br><font size=2 face="sans-serif">-> CMake Error: Could not create
named generator "Unix</font>
<br>
<br><font size=2 face="sans-serif">The reason seems to be bash separates
arguments by spaces, and does not care for the quotes.</font>
<br>
<br><font size=2 face="sans-serif">I tried to escape the space character
somehow, but nothing seems to help:</font>
<br>
<br><font size=2 face="sans-serif">export CMDLINE=". -G\"Unix\
Makefiles\"" && cmake $CMDLINE</font>
<br><font size=2 face="sans-serif">-> CMake Error: Could not create
named generator "Unix\</font>
<br>
<br><font size=2 face="sans-serif">export CMDLINE=". -G'Unix Makefiles'"
&& cmake $CMDLINE</font>
<br><font size=2 face="sans-serif">-> CMake Error: Could not create
named generator 'Unix</font>
<br>
<br><font size=2 face="sans-serif">Now there might be ways how to work
around this in bash. E.g. by quoting arguments on their own as done here</font>
<br><a href="https://stackoverflow.com/questions/42111441/how-to-pass-command-line-arguments-with-spaces-through-a-variable-in-bash"><font size=2 face="sans-serif">https://stackoverflow.com/questions/42111441/how-to-pass-command-line-arguments-with-spaces-through-a-variable-in-bash</font></a>
<br><font size=2 face="sans-serif">or here</font>
<br><a href="https://unix.stackexchange.com/questions/108635/why-i-cant-escape-spaces-on-a-bash-script"><font size=2 face="sans-serif">https://unix.stackexchange.com/questions/108635/why-i-cant-escape-spaces-on-a-bash-script</font></a>
<br><font size=2 face="sans-serif">But this is more complicated, harder
to understand and maintain - not a nice solution.</font>
<br>
<br><font size=2 face="sans-serif">Looking around, i do not seem to be
alone with this kind of problem. Example </font><a href="https://stackoverflow.com/questions/20570042/calling-cmake-with-bash-variable-argument"><font size=2 face="sans-serif">https://stackoverflow.com/questions/20570042/calling-cmake-with-bash-variable-argument</font></a>
<br>
<br><font size=2 face="sans-serif">So here is my plea to the CMake developers
and feature request:</font>
<br><font size=2 face="sans-serif">Could you please let CMake support this
kind of command line?</font>
<br><font size=2 face="sans-serif">        cmake
. -GUnix_Makefiles</font>
<br>
<br><font size=2 face="sans-serif">i mean besides the established way CMake
should accept the generator strings with '_' instead of ' '?</font>
<br><font size=2 face="sans-serif">If the command line parser could replace
'_'  by ' ' things would be backward compatible, right?</font>
<br><font size=2 face="sans-serif">This would solve problems as mentioned
above and help people to automate their CMake environments.</font>
<br>
<br><font size=2 face="sans-serif">Thank you,</font>
<br><font size=2 face="sans-serif">Stefan</font>
<br>
<br>