Reputation: 103
I'm using CMake 3.0.1 with "Visual Studio 12 2013" generator.
I added .asm files to a project. Then, the linker error LNK2026 has occurred when cmake --build .
.
The LNK2026 error is module unsafe for SAFESEH image. http://msdn.microsoft.com/en-us/library/100ezk17.aspx
If I add a project property manually as following, it works fine.
<UseSafeExceptionHandlers>true</UseSafeExceptionHandlers>
Could I avoid the linker error without changing the generated project file?
Here is a simple project that cannot build with generated .vcxproj.
extern void ExAsmCode();
int main(int argc, char** argv)
{
ExAsmCode();
return 0;
}
.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
CMAKE_MINIMUM_REQUIRED(VERSION 3.0)
PROJECT(Ex)
ENABLE_LANGUAGE(ASM_MASM)
add_executable(Ex a.c m.asm)
Upvotes: 1
Views: 1615
Reputation:
Add /safeseh
flag to source:
set_source_files_properties(
my.asm
PROPERTIES
COMPILE_FLAGS "/safeseh"
)
Upvotes: 2