title: Set PlatformTools in cl.exe
body: <p>I'm trying to build <a href="https://www.wolfssl.com/" rel="nofollow noreferrer">WolfSSL</a>, which uses the <code>CryptAcquireContext</code> function of the Windows API. I'm trying to build it using 'cl.exe'. I don't want to use 'nmake.exe' nor 'MSBuild.exe', just plain 'cl.exe'.</p>
  
  <p>If I use Visual Studio for building, I can set the <code>&lt;PlatformToolset&gt;v120&lt;/PlatformToolset&gt;</code> parameter in the 'vcxproj' file, which defines the platform toolset version. With this option set, Visual Studio compiles and links the code without error.</p>
  
  <p>If I try compiling and linking with 'cl.exe', I get the following message:</p>
  
  <p><code>error LNK2019: unresolved external symbol __imp__CryptAcquireContextA@20</code></p>
  
  <p>Since Visual Studio succeeds, the problem is not caused by a missing SDK.</p>
  
  <p>The <a href="https://msdn.microsoft.com/en-us/library/9s7c9wdw.aspx" rel="nofollow noreferrer">documentation</a> for 'cl.exe' does not include any information on platform toolset. I tried adding <code>/p:PlatformToolset=v120</code>, as suggested <a href="https://stackoverflow.com/a/20321253/6242158">here</a>, but it seems only MSBuild accepts this option.</p>
  
  <p>Though the description of my problem is long, my question is simple. How do I define the platform toolset for 'cl.exe'?</p>
  
  <p>-- EDIT --</p>
  
  <p>adding <code>Advapi32.lib</code> after the <code>\link</code> option fixed the linking problem.</p>
  
  <p>However does that mean I have to instruct the linker to use every native Windows '.lib' file I use? I don not have to do that for the standard library. Is there a way to force <code>cl</code> to include all native Windows '.lib' files automatically, just like it does with the standard library?</p>