[CMake] Conflicting MSVC manifests

Øystein Walle oystwa at gmail.com
Tue Aug 21 05:01:26 EDT 2018


Hi,

I am experiencing an error when trying to require administrator privileges on
Windows. I have made a small test case[1] available to demonstrate the issue.
CMake generates its own manifest and at link time MSVC is unable to merge
CMake's and my own manifest, giving the following error:

    manifest authoring error c1010001: Values of attribute "level" not equal
    in different manifest snippets.

The error occurs both when generating a VS project and generating Ninja build
files with the MSVC toolchain with CMake 3.12.1.

This problem can be worked around by adding the following to CMakeLists.txt
instead using the manifest file (thanks to ngladitz at #cmake at freenode):

    set_property(TARGET ${PROJECT_NAME} PROPERTY
        LINK_FLAGS "/MANIFESTUAC:level='requireAdministrator'"
    )

However, CMake has had support for adding manifest files to the list of sources
since 3.4. Should this particular usage of a manifest file be an exception? If
so, are there any other potential conflicts?

If's desirable to rather fix the issue maybe the options I see are:

 - Use the user's manifest (if present) and discard CMake's own,
 - Configure MSVC to let one manifest file yield when conflicts are present
   (not sure if this is possible),
 - Do the merge in CMake itself (yuck, I guess...)

I'm new to the MSVC toolchain so there may be some obvious solutions I
am overlooking here...

Regards,
Øsse

[1]: https://github.com/Osse/manifesttest


More information about the CMake mailing list