title: CMake: How to avoid link error when the project contains .asm MASM sources with VS2013?
body: <p>I'm using CMake 3.0.1 with "Visual Studio 12 2013" generator.</p>
  
  <p>I added .asm files to a project. Then, the linker error LNK2026 has occurred when <code>cmake --build .</code>.</p>
  
  <p>The LNK2026 error is <em>module unsafe for SAFESEH image</em>.
  <a href="http://msdn.microsoft.com/en-us/library/100ezk17.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/100ezk17.aspx</a></p>
  
  <p>If I add a project property manually as following, it works fine.</p>
  
  <blockquote>
    <p>&lt;UseSafeExceptionHandlers&gt;true&lt;/UseSafeExceptionHandlers&gt;</p>
  </blockquote>
  
  <p>Could I avoid the linker error without changing the generated project file?</p>
  
  <p>Here is a simple project that cannot build with generated .vcxproj.</p>
  
  <h2>a.c</h2>
  
  <pre><code>extern void ExAsmCode();
  
  int main(int argc, char** argv)
  {
      ExAsmCode();
      return 0;
  }
  </code></pre>
  
  <h2>m.asm</h2>
  
  <pre><code>.586
  .model flat, c
  MessageBoxA     proto STDCALL :dword, :dword, :dword, :dword
  
  .data
  
  MSG          DB 'masm', 0
  
  .code
  
  ExAsmCode PROC
      invoke MessageBoxA, 0, offset MSG, offset MSG, 0
      ret
  ExAsmCode ENDP
  
  end
  </code></pre>
  
  <h2>CMakeLists.txt</h2>
  
  <pre><code>CMAKE_MINIMUM_REQUIRED(VERSION 3.0)
  
  PROJECT(Ex)
  
  ENABLE_LANGUAGE(ASM_MASM)
  
  add_executable(Ex a.c m.asm)
  </code></pre>