[cmake-developers] CMake user-provided manifest files

Brad King brad.king at kitware.com
Mon Sep 14 16:16:19 EDT 2015


On 09/11/2015 03:02 PM, Brad King wrote:
> On 09/11/2015 02:09 PM, Brad King wrote:
>> I would be very happy to get rid of the vs_link_exe and vs_link_dll code.
> 
> There is documentation here about what those are doing:
> 
>  https://msdn.microsoft.com/en-us/library/ms235591.aspx
>  http://blogs.msdn.com/b/zakramer/archive/2006/05/22/603558.aspx

I just looked back through the implementations of vs_link_{exe,dll}
in more detail.  For non-incremental linking it just does:

 link ... /manifest /out:Foo.exe ...
 mt -manifest Foo.exe.manifest -outputresource:Foo.exe;1

For incremental linking it does:

 (create empty "embed.manifest" and Foo.rc referencing it)
 rc Foo.rc -foFoo.res
 link ... /manifest /manifestfile:tmp.manifest Foo.res
 mt -manifest tmp.manifest -out:embed.manifest
 (if "embed.manifest" changed):
   rc Foo.rc -foFoo.res
   link ... /manifest /manifestfile:tmp.manifest Foo.res

The latter/conditional "rc" and "link" invocations are identical
to the first invocations of these tools.

In both cases the link tool generates the manifest file and then
some steps are taken to embed it in the binary.  In both cases
there is a "mt" invocation that could be extended to list
user-provided manifest files after the linker-generated one.

On 09/11/2015 11:45 AM, James Johnston wrote:
> Because CMake already does *some* things with the linker it makes it
> impossible for me to cleanly specify and use link.exe manifest-related
> switches myself.  For example, it hard-codes usage of link.exe /MANIFESTFILE
> and the user can't specify their own location.  And the locations it does
> use are undocumented.

Is there a use case for doing something with the linker-generated
manifest file other than passing it to a "mt" invocation along
with (possibly) user-specified manifest files?  If not then there
is no reason to make the manifest file location public.

I think our path forward here is to teach the Makefile and Ninja
generators how to add user-specified manifest files to the "mt"
invocations as outlined above.  Gilles has already posted an
implementation for doing this on VS 10+.

-Brad



More information about the cmake-developers mailing list