Compiling blender as a python module on Win8.1, VS2013 gives the error:
FAILED: cmd.exe /C "cd . && "C:\Program Files (x86)\CMake\bin\cmake.exe" -E vs_link_dll C:\PROGRA~2\MICROS~3.0\VC\bin\am d64\link.exe /nologo @CMakeFiles/blender.rsp /out:bin\bpy.pyd /implib:lib\bpy.lib /pdb:bin\bpy.pdb /dll /version:0.0 /m achine:x64 /SAFESEH:NO /debug /INCREMENTAL && cd ." MSVCRT.lib(MSVCR120.dll) : error LNK2005: longjmp already defined in LIBCMT.lib(longjmp.obj) MSVCRT.lib(MSVCR120.dll) : error LNK2005: memmove already defined in LIBCMT.lib(memcpy.obj) MSVCRT.lib(MSVCR120.dll) : error LNK2005: strncmp already defined in LIBCMT.lib(strncmp.obj) MSVCRT.lib(MSVCR120.dll) : error LNK2005: strstr already defined in LIBCMT.lib(strstr.obj) MSVCRT.lib(MSVCR120.dll) : error LNK2005: qsort already defined in LIBCMT.lib(qsort.obj) MSVCRT.lib(MSVCR120.dll) : error LNK2005: atol already defined in LIBCMT.lib(atox.obj) MSVCRT.lib(MSVCR120.dll) : error LNK2005: memchr already defined in LIBCMT.lib(memchr.obj) MSVCRT.lib(MSVCR120.dll) : error LNK2005: sprintf already defined in LIBCMT.lib(sprintf.obj) MSVCRT.lib(MSVCR120.dll) : error LNK2005: fclose already defined in LIBCMT.lib(fclose.obj) MSVCRT.lib(MSVCR120.dll) : error LNK2005: fopen already defined in LIBCMT.lib(fopen.obj) MSVCRT.lib(MSVCR120.dll) : error LNK2005: fread already defined in LIBCMT.lib(fread.obj) MSVCRT.lib(MSVCR120.dll) : error LNK2005: fseek already defined in LIBCMT.lib(fseek.obj) MSVCRT.lib(MSVCR120.dll) : error LNK2005: ftell already defined in LIBCMT.lib(ftell.obj) MSVCRT.lib(MSVCR120.dll) : error LNK2005: free already defined in LIBCMT.lib(free.obj) MSVCRT.lib(MSVCR120.dll) : error LNK2005: malloc already defined in LIBCMT.lib(malloc.obj) MSVCRT.lib(MSVCR120.dll) : error LNK2005: realloc already defined in LIBCMT.lib(realloc.obj) MSVCRT.lib(MSVCR120.dll) : error LNK2005: strncpy already defined in LIBCMT.lib(strncpy.obj) MSVCRT.lib(MSVCR120.dll) : error LNK2005: strrchr already defined in LIBCMT.lib(strrchr.obj) MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: __cdecl type_info::type_info(class type_info const &)" (??0type_info@ @AEAA@AEBV0@@Z) already defined in LIBCMT.lib(typinfo.obj) MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: class type_info & __cdecl type_info::operator=(class type_info const &)" (??4type_info@@AEAAAEAV0@AEBV0@@Z) already defined in LIBCMT.lib(typinfo.obj) Creating library lib\bpy.lib and object lib\bpy.exp LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library bin\bpy.pyd : fatal error LNK1169: one or more multiply defined symbols found
/NODEFAULTLIB is already defined in PLATFORM_LINKFLAGS, but this is only set on CMAKE_EXE_LINKER_FLAGS, so shared/module files (like bpy.pyd) don't get these flags.
This patch adds these flags to CMAKE_(SHARED|MODULE)_LINKER_FLAGS