[CMake] cmake env - no command given

Petr Kmoch petr.kmoch at gmail.com
Mon Feb 8 04:14:12 EST 2016


Hi Lars.

No, that's a "bug" in your command-line. In cmd, the caret ^ is used as a
general escape character for escaping spaces, pipes etc. But to escape
quotes, a backslash \ is used (yes, the escaping rules in cmd are weird).
So the backslash preceding the quote is taken by cmd to be an escape
character, and the quote becomes a literal quote character instead of
terminating the argument. You're left without a closing quote, which cmd
apparently auto-fill, so you end up passing the string `PATH=C:\temp" calc`
as one argument, and no other argument.

If you need the backslash before the quote, you need to double it:

"C:\Program Files (x86)\CMake\bin\cmake.exe" -E env "PATH=C:\temp\\" calc

Petr

On Mon, Feb 8, 2016 at 10:02 AM, Lars <laasunde at hotmail.com> wrote:

> Hello,
>
> Using Windows 7 SP1 and cmake 3.3.0
>
> The first command below works (starts calc) when execute in cmd shell. The
> second command produces the error message "cmake -E env: no command given".
> Is this a bug in cmake?
>
> "C:\Program Files (x86)\CMake\bin\cmake.exe" -E env "PATH=C:\temp" calc
> "C:\Program Files (x86)\CMake\bin\cmake.exe" -E env "PATH=C:\temp\" calc
>
>
> regards, Lars
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160208/4513320d/attachment.html>


More information about the CMake mailing list