Conflicting MSVC manifests

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Conflicting MSVC manifests

Øystein Walle
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@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
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Conflicting MSVC manifests

Bo Zhou
From my personal experience, I suggest never touch the manifest, because it's not a useful configuration to solve the DLL hell issue since Windows XP.

Instead, once we know the exact version of Visual Studio with Update, the distributor just ship the MSVC runtime installer with software, the installer would install the required MSVCRuntime locally, so everything almost exactly matches without touching the crazy configuration.

On MSVC, you should always use Visual Studio MSBuild rather than the other build system, just use

cmake --build <build_dir> --target INSTALL --config Release

That's it.

Thank you very much.

On Tue, Aug 21, 2018 at 6:02 PM Øystein Walle <[hidden email]> wrote:
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@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
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake