-
Notifications
You must be signed in to change notification settings - Fork 464
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CMake task provider does not configure the VS Build environment for Ninja builds #2258
Comments
Ok, you can disregard the massive logs from above. I can reproduce the issue with a tiny project: main.cpp:
CMakeLists.txt:
.vscode/settings.json:
.vscode/tasks.json:
If I run this task I get:
If I press F7 build succeeds. |
@bobbrow any insights? |
Sorry. I'm not sure how this fell off our radar. Thanks for the ping. We'll take a look today. |
This assessment is correct. I'm not sure how that was missed in the implementation, but I definitely don't see any code in the task provider that configures the environment for Ninja builds. It works for me if I use the Visual Studio generators. The only other workaround for now would be to open a Developer Command prompt and launch VS Code from inside that to inherit the build environment. |
I tested using pre-release version and build works with test project and with real project. But it is not very useful because it always builds "all" target. Is there a way to specify in tasks.json a target to build, "install" in my case? |
Not yet. We have feature #2122 tracking that. @elahehrashedi maybe we can put that into 1.11. |
Thanks, I'll follow that issue. This one can be considered confirmed fixed. |
Brief Issue Summary
Build succeeds if launched from "Cmake: Build" palette command or using F7 shortcut.
Build fails if launched using task with configuration:
These are cmake related settings from settings.json:
CMake Tools Diagnostics
Debug Log
This is the output to the terminal if I launch from a task. It doesn't output anything to output tab.
This is the output of running build with F7 right after getting output above with no other changes.
Additionally, if I configure the project with "CMAKE_VERBOSE_MAKEFILE": "ON" then I can see actual commands that ninja is running when launched with F7:
If you compare these commands to the ones seen in terminal output of failed cmake build launched from a task, they are exactly the same, as expected. Which makes me think the difference is in the environment variables that are not picked up if build is ran from task.
The text was updated successfully, but these errors were encountered: