title: Visual Studio seemingly ignoring runtime library set in cmake
body: <p>There are many posts about how to set the Runtime library in Visual Studio from CMake, but in my case it seems that Visual Studio is ignoring my setting.</p>
  
  <p>I would like to build google-mock with <code>/MD</code>.  This is the default setting in the project.</p>
  
  <p>In a fresh build directory, built with:</p>
  
  <pre><code>cmake -G "Visual Studio 12 2013" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=C:\Users\mrussell\workspace\opal2\o2win32\Libs\gtest\"1.7.0" -DCMAKE_CXX_FLAGS_RELEASE="/MD /O2 /Ob2 /D NDEBUG" ../googlemock
  </code></pre>
  
  <p>All my cmake variables seem correct</p>
  
  <p><a href="https://i.stack.imgur.com/Ol9DY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ol9DY.png" alt="cmake-gui showing all flags have /MD"></a></p>
  
  <p>However, when I go to build, either via the command line (I'm used to linux..) or from Visual Studio, it uses the <code>/MT</code> flag.</p>
  
  <p>My build command (targeting 32 bit):</p>
  
  <pre><code>call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\vcvars32.bat"
  msbuild /m:4 /property:Configuration=%build_type% ALL_BUILD.vcxproj
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>   ClCompile:
       C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\CL.exe /c /IC:\Users\mrussell\workspace\opal2\o2win32\Libs\gtest\g
       test\include /IC:\Users\mrussell\workspace\opal2\o2win32\Libs\gtest\gtest /Zi /nologo /W4 /WX /O2 /Ob2 /Oy- /D WIN32 /D _WIND
       OWS /D NDEBUG /D WIN32 /D _WINDOWS /D _UNICODE /D UNICODE /D WIN32 /D _WIN32 /D STRICT /D WIN32_LEAN_AND_MEAN /D GTEST_HAS_PT
       HREAD=0 /D _HAS_EXCEPTIONS=1 /D "CMAKE_INTDIR=\"Release\"" /D _UNICODE /D UNICODE /Gm- /EHsc /MT /GS /fp:precise /Zc:wchar_t
       /Zc:forScope /GR /Fo"gtest.dir\Release\\" /Fd"gtest.dir\Release\vc120.pdb" /Gd /TP /wd4127 /wd4251 /wd4275 /analyze- /errorRe
       port:queue  -J "C:\Users\mrussell\workspace\opal2\o2win32\Libs\gtest\gtest\src\gtest-all.cc"
  </code></pre>
  
  <p>(note the <code>/MT</code> hiding in there.)</p>
  
  <p>In Visual Studio, I open the solution, choose release type <code>Release</code>, and in any of the targets, say <code>gtest</code>, <code>Properties</code> -> <code>Configuration Properties</code> -> <code>C/C++</code> -> <code>Code Generation</code>, the <code>Runtime Library</code> is set to <code>/MT</code>, not <code>/MD</code> as set in the Cmake file.</p>
  
  <p>Same thing happens if I try to build google-test (1.7.0)</p>
  
  <p>Do I just not understand how to set these?  Or is there a way to force Visual Studio to use the right flag without manually opening Visual Studio and setting it?</p>