microsoft / microsoft/vscode-cmake-tools
Build task isn't colored in terminal
- Dominant language
- TypeScript
- Stars
- 1.7k
- Forks
- 546
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 32
Description
### Brief Issue Summary
I'm trying to get color output in terminal. Suggested workaround here https://github.com/microsoft/vscode-cmake-tools/issues/478#issuecomment-1081093372 isn't working as expected.
Compiler errors are only colored with `set(CMAKE_CXX_FLAGS -fdiagnostics-color=always)` is in **CMakeList.txt**,
but "Building CXX Object" messages are still in white.
Switching task to shell command shows desired colored output ("Building CXX Object" messages are in green color):
```json
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "CMake: build and run",
"command": "cmake --build ${workspaceFolder}/build --config Debug --target ${workspaceFolderBasename} && ${workspaceFolder}/build/${workspaceFolderBasename}",
"group": "build"
}
]
}
```
### CMake Tools Diagnostics
CMake: Log Diagnostics
```shell
{
"os": "linux",
"vscodeVersion": "1.72.0",
"cmtVersion": "1.12.27",
"configurations": [
{
"folder": "/home/serfreeman1337/Dev/tmp-esp32-cv-test",
"cmakeVersion": "3.24.2",
"configured": true,
"generator": "Unix Makefiles",
"usesPresets": false,
"compilers": {
"C": "/usr/bin/gcc",
"CXX": "/usr/bin/g++"
}
}
],
"cpptoolsIntegration": {
"isReady": true,
"hasCodeModel": true,
"activeBuildType": "Debug",
"buildTypesSeen": [
"Debug"
],
"requests": [
"file:///home/serfreeman1337/Dev/tmp-esp32-cv-test/oh.cc",
"file:///home/serfreeman1337/Dev/tmp-esp32-cv-test/tmp-esp32-cv-test.cc"
],
"responses": [
{
"uri": "file:///home/serfreeman1337/Dev/tmp-esp32-cv-test/oh.cc",
"configuration": {
"includePath": [
"/usr/include/opencv4"
],
"defines": [],
"compilerPath": "/usr/bin/g++",
"compilerArgs": [],
"compilerFragments": [
"-g",
"-std=gnu++17"
]
}
},
{
"uri": "file:///home/serfreeman1337/Dev/tmp-esp32-cv-test/tmp-esp32-cv-test.cc",
"configuration": {
"includePath": [
"/usr/include/opencv4"
],
"defines": [],
"compilerPath": "/usr/bin/g++",
"compilerArgs": [],
"compilerFragments": [
"-g",
"-std=gnu++17"
]
}
}
],
"partialMatches": [],
"targetCount": 1,
"executablesCount": 1,
"librariesCount": 0,
"targets": [
{
"name": "tmp-esp32-cv-test",
"type": "EXECUTABLE"
}
]
},
"settings": [
{
"communicationMode": "automatic",
"useCMakePresets": "auto",
"configureOnOpen": true
}
]
}
```
### Debug Log
_No response_
### Additional Information
Screenshots
Workaroud with `set(CMAKE_CXX_FLAGS -fdiagnostics-color=always)`:

Task as shell command without `fdiagnostics-color` flag:

Contributor guide
Research direction
No repository files, tests, or entry points are named. Start by tracing the CMake build task's terminal output handling and compare it with the shell task behavior described in the issue; done means the built-in build task displays the build messages with the expected colors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, typescript
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100