Reputation: 39013
I'm trying to use Powershell as my main shell in Windows 10. Most of the time it works well, but some things cause me to move back to the old Command Prompt, and I wish they wouldn't.
I'm trying to use cmake to create a Visual Studio solution. Here is the command line that works properly in command prompt (broken into lines for clarity)
cmake .. -G "Visual Studio 14 2015" -A x64
-DBOOST_ROOT=d:\boost\1_59_0
-DBOOST_LIBRARYDIR=d:\boost\1_59_0\lib64
When I run the same command from Powershell, cmake complains I did not specify BOOST_ROOT.
I tried using & cmake ...
, I tried putting quotes around all the -D's (as explained here) - nothing works. I just can't make Powershell pass the command line as is to cmake.
Is there a way to tell Powershell to pass the text following 'cmake' directly to cmake without any further processing? Note that I can't put quotes around all the arguments, since they already have quotes in them (-G...). If I put single quotes around everything - it still doesn't work.
Upvotes: 1
Views: 1721
Reputation: 14705
For starting external programs in PowerShell it's best to use Start-Process
with its -ArgumentList
parameter:
Start-Process cmake -ArgumentList "-G ""Visual Studio 14 2015"" -A x64 -DBOOST_ROOT=d:\boost\1_59_0 -DBOOST_LIBRARYDIR=d:\boost\1_59_0\lib64" -NoNewWindow
More info on this Cmdlet can be found on the Microsoft help or by using the following command in PowerShell:
Get-Help Start-Process -ShowWindow
Upvotes: 2