Based on @wesley-banfield 's answer, I got it ran sucessfully:
{
"tasks": [
{
"type": "shell",
"options": {
"shell": {
"args": ["-i"]
},
"cwd": "${workspaceFolder}"
},
"label": "C/C++: g++ build active file",
"command": "conda activate test; cmake --build build -j 256",
"problemMatcher": [
"$gcc"
],
"group": "build",
"detail": "compiler: /usr/bin/g++"
}
],
"version": "2.0.0"
}