Skip to main content
Updated from deprecated workspaceRoot to workspaceFolder
Source Link
{ "label": "cmake", "type": "shell", "options": { "cwd": "${workspaceRootworkspaceFolder}/build" }, "command": "cmake \"MinGW Makefiles\" ${workspaceRootworkspaceFolder}", }, 

This works, It seems that the "Executing task in folder cpppractice:" is not accurate and it is executing it in the correct place, as for why it did not work previously I think it's parsing the args incorrectly? I can't confirm, but here is the output:

Executing task in folder cpppractice: cmake "MinGW Makefiles" C:\workspace\cpp\cpppractice < -- Configuring done -- Generating done -- Build files have been written to: C:/workspace/cpp/cpppractice/build 

Where previously it was compalining about not being able Use the generator "MinGW" which means that it separating the argument "MinGW Makefiles". After some tinkering I found out that this is also an answer:

{ "label": "cmake", "type": "shell", "options": { "cwd": "${workspaceRootworkspaceFolder}/build" }, "command": "cmake", "args": [ "-G", "'MinGW Makefiles'", "./.." ], ... }, 

I actually find the second approach a little bit cleaner but both work the same, So in order to pass an argument as a string you have to use single quotes like so:

... "command":"echo", "args": [ "'Za Warudo!'", ], ... 
{ "label": "cmake", "type": "shell", "options": { "cwd": "${workspaceRoot}/build" }, "command": "cmake \"MinGW Makefiles\" ${workspaceRoot}", }, 

This works, It seems that the "Executing task in folder cpppractice:" is not accurate and it is executing it in the correct place, as for why it did not work previously I think it's parsing the args incorrectly? I can't confirm, but here is the output:

Executing task in folder cpppractice: cmake "MinGW Makefiles" C:\workspace\cpp\cpppractice < -- Configuring done -- Generating done -- Build files have been written to: C:/workspace/cpp/cpppractice/build 

Where previously it was compalining about not being able Use the generator "MinGW" which means that it separating the argument "MinGW Makefiles". After some tinkering I found out that this is also an answer:

{ "label": "cmake", "type": "shell", "options": { "cwd": "${workspaceRoot}/build" }, "command": "cmake", "args": [ "-G", "'MinGW Makefiles'", "./.." ], ... }, 

I actually find the second approach a little bit cleaner but both work the same, So in order to pass an argument as a string you have to use single quotes like so:

... "command":"echo", "args": [ "'Za Warudo!'", ], ... 
{ "label": "cmake", "type": "shell", "options": { "cwd": "${workspaceFolder}/build" }, "command": "cmake \"MinGW Makefiles\" ${workspaceFolder}", }, 

This works, It seems that the "Executing task in folder cpppractice:" is not accurate and it is executing it in the correct place, as for why it did not work previously I think it's parsing the args incorrectly? I can't confirm, but here is the output:

Executing task in folder cpppractice: cmake "MinGW Makefiles" C:\workspace\cpp\cpppractice < -- Configuring done -- Generating done -- Build files have been written to: C:/workspace/cpp/cpppractice/build 

Where previously it was compalining about not being able Use the generator "MinGW" which means that it separating the argument "MinGW Makefiles". After some tinkering I found out that this is also an answer:

{ "label": "cmake", "type": "shell", "options": { "cwd": "${workspaceFolder}/build" }, "command": "cmake", "args": [ "-G", "'MinGW Makefiles'", "./.." ], ... }, 

I actually find the second approach a little bit cleaner but both work the same, So in order to pass an argument as a string you have to use single quotes like so:

... "command":"echo", "args": [ "'Za Warudo!'", ], ... 
added 88 characters in body
Source Link
Immac
  • 561
  • 1
  • 6
  • 18
{ "label": "cmake", "type": "shell", "options": { "cwd": "${workspaceRoot}/build" }, "command": "cmake \"MinGW Makefiles\" ${workspaceRoot}", }, 

This works, It seems that the "Executing task in folder cpppractice:" is not accurate and it is executing it in the correct place, as for why it did not work previously I think it's parsing the args incorrectly? I can't confirm, but here is the output:

Executing task in folder cpppractice: cmake "MinGW Makefiles" C:\workspace\cpp\cpppractice < -- Configuring done -- Generating done -- Build files have been written to: C:/workspace/cpp/cpppractice/build 

Where previously it was compalining about not being able Use the generator "MinGW" which means that it separating the argument "MinGW Makefiles". After some tinkering I found out that this is also an answer:

{ "label": "cmake", "type": "shell", "options": { "cwd": "${workspaceRoot}/build" }, "command": "cmake", "args": [ "-G", "'MinGW Makefiles'", "./.." ], ... }, 

I actually find the second approach a little bit cleaner but both work the same, So in order to pass an argument as a string you have to use single quotes like so 'Za Warudo!'.:

... "command":"echo", "args": [ "'Za Warudo!'", ], ... 
{ "label": "cmake", "type": "shell", "options": { "cwd": "${workspaceRoot}/build" }, "command": "cmake \"MinGW Makefiles\" ${workspaceRoot}", }, 

This works, It seems that the "Executing task in folder cpppractice:" is not accurate and it is executing it in the correct place, as for why it did not work previously I think it's parsing the args incorrectly? I can't confirm, but here is the output:

Executing task in folder cpppractice: cmake "MinGW Makefiles" C:\workspace\cpp\cpppractice < -- Configuring done -- Generating done -- Build files have been written to: C:/workspace/cpp/cpppractice/build 

Where previously it was compalining about not being able Use the generator "MinGW" which means that it separating the argument "MinGW Makefiles". After some tinkering I found out that this is also an answer:

{ "label": "cmake", "type": "shell", "options": { "cwd": "${workspaceRoot}/build" }, "command": "cmake", "args": [ "-G", "'MinGW Makefiles'", "./.." ], ... }, 

I actually find the second approach a little bit cleaner but both work the same, So in order to pass an argument as a string you have to use single quotes like so 'Za Warudo!'.

{ "label": "cmake", "type": "shell", "options": { "cwd": "${workspaceRoot}/build" }, "command": "cmake \"MinGW Makefiles\" ${workspaceRoot}", }, 

This works, It seems that the "Executing task in folder cpppractice:" is not accurate and it is executing it in the correct place, as for why it did not work previously I think it's parsing the args incorrectly? I can't confirm, but here is the output:

Executing task in folder cpppractice: cmake "MinGW Makefiles" C:\workspace\cpp\cpppractice < -- Configuring done -- Generating done -- Build files have been written to: C:/workspace/cpp/cpppractice/build 

Where previously it was compalining about not being able Use the generator "MinGW" which means that it separating the argument "MinGW Makefiles". After some tinkering I found out that this is also an answer:

{ "label": "cmake", "type": "shell", "options": { "cwd": "${workspaceRoot}/build" }, "command": "cmake", "args": [ "-G", "'MinGW Makefiles'", "./.." ], ... }, 

I actually find the second approach a little bit cleaner but both work the same, So in order to pass an argument as a string you have to use single quotes like so:

... "command":"echo", "args": [ "'Za Warudo!'", ], ... 
Source Link
Immac
  • 561
  • 1
  • 6
  • 18

{ "label": "cmake", "type": "shell", "options": { "cwd": "${workspaceRoot}/build" }, "command": "cmake \"MinGW Makefiles\" ${workspaceRoot}", }, 

This works, It seems that the "Executing task in folder cpppractice:" is not accurate and it is executing it in the correct place, as for why it did not work previously I think it's parsing the args incorrectly? I can't confirm, but here is the output:

Executing task in folder cpppractice: cmake "MinGW Makefiles" C:\workspace\cpp\cpppractice < -- Configuring done -- Generating done -- Build files have been written to: C:/workspace/cpp/cpppractice/build 

Where previously it was compalining about not being able Use the generator "MinGW" which means that it separating the argument "MinGW Makefiles". After some tinkering I found out that this is also an answer:

{ "label": "cmake", "type": "shell", "options": { "cwd": "${workspaceRoot}/build" }, "command": "cmake", "args": [ "-G", "'MinGW Makefiles'", "./.." ], ... }, 

I actually find the second approach a little bit cleaner but both work the same, So in order to pass an argument as a string you have to use single quotes like so 'Za Warudo!'.