title: CMAKE - setting compile flags for libraries
body: <p>I have a CMakeLists.txt script to compile my libraries. 
  The problem is I cannot set the compile flags for the libraries.</p>
  
  <p>I've tried</p>
  
  <pre><code>SET(CMAKE_CXX_FLAGS "/W3 /nologo /EHsc")
  SET(CMAKE_CXX_FLAGS_DEBUG "/MTd /Od /Ob0 /Zi /RTC1 /DDEBUG /D_DEBUG")
  SET(CMAKE_CXX_FLAGS_RELEASE "/MT /O2 /Ob2 /DNDEBUG")
  SET(CMAKE_C_FLAGS "/W3 /nologo /EHsc")
  SET(CMAKE_C_FLAGS_DEBUG "/MTd /Od /Ob0 /Zi /RTC1 /DDEBUG /D_DEBUG")
  SET(CMAKE_C_FLAGS_RELEASE "/MT /O2 /Ob2 /DNDEBUG")
  SET(CMAKE_EXE_LINKER_FLAGS "/W3 /nologo /EHsc")
  SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "/MTd /Od /Ob0 /Zi /RTC1 /DDEBUG /D_DEBUG")
  SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "/MT /O2 /Ob2 /DNDEBUG")
  SET(CMAKE_MODULE_LINKER_FLAGS "/W3 /nologo /EHsc")
  SET(CMAKE_MODULE_LINKER_FLAGS_DEBUG "/MTd /Od /Ob0 /Zi /RTC1 /DDEBUG /D_DEBUG")
  SET(CMAKE_MODULE_LINKER_FLAGS_RELEASE "/MT /O2 /Ob2 /DNDEBUG")
  SET(CMAKE_SHARED_LINKER_FLAGS "/W3 /nologo /EHsc")
  SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG "/MTd /Od /Ob0 /Zi /RTC1 /DDEBUG /D_DEBUG")
  SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE "/MT /O2 /Ob2 /DNDEBUG")
  SET(CMAKE_STATIC_LINKER_FLAGS "/W3 /nologo /EHsc")
  SET(CMAKE_STATIC_LINKER_FLAGS_DEBUG "/MTd /Od /Ob0 /Zi /RTC1 /DDEBUG /D_DEBUG")
  SET(CMAKE_STATIC_LINKER_FLAGS_RELEASE "/MT /O2 /Ob2 /DNDEBUG")
  </code></pre>
  
  <p>None of those have effect...</p>
  
  <p>The only way I can change flags for a library is like this.</p>
  
  <pre><code>SET_TARGET_PROPERTIES(MyLib PROPERTIES COMPILE_FLAGS "/W3 /nologo /EHsc")
  </code></pre>
  
  <p>and this will change the flags for both Debug and Release</p>
  
  <p>How in the world can I set the Release and Debug flags separately for a library using CMake?</p>