execute_process: Add option to execute a raw command line on Windows
execute_process
is unable to pass a unescaped quote symbol "
as a parameter on Windows.
The quote just get escaped, i. e. instead "
I get \"
passed to created process parameters. I need to pass a clear quote.
How to reproduce:
-
Download [Process Monitor] (https://technet.microsoft.com/en-us/sysinternals/processmonitor.aspx), so you'll be able to monitor raw parameters passed to created processes.
-
Create an
sample.cmake
file with following contents:execute_process(COMMAND $ENV{COMSPEC} "/C" "echo\"\"")
-
Run Process Monitor, start capturing system events (it will start automatically after you press OK in filters window, after you can toggle it with
File->Capture Events
) -
Run
cmake -P sample.cmake
in command prompt. -
Stop capturing events, go to
Tools->Process Tree
, locate launchedcmd.exe
process with short lifetime, check itCommand
column value. -
Expected value
C:\Windows\System32\cmd.exe /C echo""
gathered valueC:\Windows\System32\cmd.exe /C echo\"\"