title: Setting up platform-specific default tasks in VS Code
body: <h1>Broader Question:</h1>
  <p>This post originally asked about how to specify a platform-specific problem matcher, but it seems that the more important question to be answered is:</p>
  <p><strong>How do you set up platform-specific properties for tasks when those properties are not recognized in the &quot;windows&quot; or &quot;linux&quot; sections?</strong></p>
  <p>Even if I break this task into two tasks, it seems that only one of them can be set as the default build task for both platforms.</p>
  <p><em>Before anyone asks, this problem stems from the need to commit my tasks.json file to the repository so that the other developers are able to build the project on any platform using the &quot;Run Build Task...&quot; command in VS Code. I realize they could always change the default task after checking out the code.</em></p>
  <h1>Original Question:</h1>
  <p>I have a task in VSCode that runs a shell/batch script for building my C++ (CMake) application. The task makes use of the <code>&quot;windows&quot;</code> and <code>&quot;linux&quot;</code> keys for platform-specific commands.</p>
  <pre class="lang-json prettyprint-override"><code>{
    &quot;label&quot;: &quot;Build x64&quot;,
    &quot;type&quot;: &quot;shell&quot;,
    &quot;windows&quot;: { &quot;command&quot;: &quot;${workspaceRoot}/Build-Win-x64.bat&quot; },
    &quot;linux&quot;: { &quot;command&quot;: &quot;${workspaceRoot}/Build-Linux-x64.sh&quot; },
    &quot;group&quot;: { &quot;kind&quot;: &quot;build&quot;, &quot;isDefault&quot;: true }
  }
  </code></pre>
  <p>The Windows script builds with the MSVC compiler which requires putting <code>&quot;problemMatcher&quot;: &quot;$msCompile&quot;</code> in the task so that VSCode can parse the compiler output.</p>
  <p>However the Linux script uses GCC which requires <code>&quot;problemMatcher&quot;: &quot;$gcc&quot;</code>.</p>
  <p>These values seem to be mutually exclusive and VSCode does not allow them inside the platform-specific properties.</p>
  <p><strong>Is there any way to set up a default build task with different problem matchers for each platform?</strong></p>
  <p>I've thought about using an environment variable like this <code>&quot;problemMatcher&quot;: &quot;${env:VSCODE_CPP_MATCHER}&quot;</code> but this would be annoying to set up for every workstation that works with this project.</p>