CMake command not working in VS Code task


CMake command not working in VS Code task



I have created a task in my tasks.json file in Visual Studio Code:


tasks.json


{
"label": "cmake",
"command": "cmake",
"args": [
"-G",
""Unix Makefiles"",
"-DCMAKE_BUILD_TYPE=Debug",
".."
],
"options": {
"cwd": "${workspaceRoot}/build"
},
"problemMatcher":
},



When I run it from within VSC (Tasks: run task > cmake), I get the following error:


> Executing task: cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug .. <

CMake Error: Could not create named generator "Unix Makefiles"

Generators
Unix Makefiles = Generates standard UNIX makefiles.
Ninja = Generates build.ninja files.
Xcode = Generate Xcode project files.
CodeBlocks - Ninja = Generates CodeBlocks project files.
CodeBlocks - Unix Makefiles = Generates CodeBlocks project files.
CodeLite - Ninja = Generates CodeLite project files.
CodeLite - Unix Makefiles = Generates CodeLite project files.
Sublime Text 2 - Ninja = Generates Sublime Text 2 project files.
Sublime Text 2 - Unix Makefiles
= Generates Sublime Text 2 project files.
Kate - Ninja = Generates Kate project files.
Kate - Unix Makefiles = Generates Kate project files.
Eclipse CDT4 - Ninja = Generates Eclipse CDT 4.0 project files.
Eclipse CDT4 - Unix Makefiles= Generates Eclipse CDT 4.0 project files.

The terminal process terminated with exit code: 1



However if I execute the exact same command in terminal it works as expected:


oyvinds-MacBook:build oyvindhauge$ cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug ..-- Configuring done
-- Generating done
-- Build files have been written to: /Users/oyvindhauge/Documents/Development/[PROJECT]/build
oyvinds-MacBook:build oyvindhauge$



Any idea what's going on?





I am not expert in VS Code, but error message smells like a quoted string has been passed as generator: "Unix Makefiles". Probably, there is no needs in adding additional quotation around -G parameter?
– Tsyvarev
Jun 30 at 19:57



"Unix Makefiles"


-G





Alright, I'll look into this. Thanks.
– Øyvind Hauge
yesterday









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Render GeoTiff to on browser with leaflet

How to get chrome logged in user's email id through website

using states in a react-navigation without redux