The linker with Visual studio and ninja is very complicated.
It runs:
cmake.exe -E vs_link_exe --intdir=Components\OSBase\Common\Temperature\UnitTest\CMakeFiles\UT_temperature.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100203~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100203~1.0\x64\mt.exe --manifests -- C:\PROGRA~2\MIB055~1\2019\PROFES~1\VC\Tools\MSVC\1429~1.301\bin\Hostx64\x64\link.exe /nologo ...
vs_link_exe is explained nowhere in documentation. You can find it in source code (cmcmd.cxx). There it states:
// For visual studio 2005 and newer manifest files need to be embedded into
// exe and dll's. This code does that in such a way that incremental linking
// still works.
However, you can disable embedding manifest files in Visual Studio. See here.
I cannot find the option to remove embedding manifest files. Do I need to patch the linker command that is created by Windows-MSVC.cmake?
What would you think of a patch retries mt.exe a few times (here)? The antivirus issue linked above must affect more people then me… See also on Stack Overflow.
btw: why was linking (non-incremental) implemented as C+±code? Why not call link.exe ... && mt.exe ...
? What is incremental linking and when is it used?
Also, something I saw, which is quite strange: The linker commandlines for Debug and Release are very similar. However, in Release, my CMAKE_RUNTIME_OUTPUT_DIRECTORY contains *.manifest files, while the Debug does not.