Commit 5087aa3f authored by Brian Paul's avatar Brian Paul

cmake: create Win10 manifest files for particular executables

On Windows10 (and possibly older versions), UAC (User Account Control)
intervenes when starting an executables with "patch", "update" or "setup"
in their name.  This requires the user to approve execution by clicking
in a dialog window (and even then, causes test failures).  With Cygwin,
you simply get "Permission Denied".

Currently, there are four Piglit tests which need this special treatment:

A work-around is to create a manifest file for each effected executable.
This patch creates a <foo>.exe.manifest file if "foo" contains any of
the above strings.  There's no effect on non-Windows platforms.

Note: this solution uses the cmake file(GENERATE ...) function.  I think
add_custom_command() is probably the proper approach, but I've been
unsuccessful in getting that to work.
Reviewed-by: Charmaine Lee's avatarCharmaine Lee <>
parent 639ecb3b
......@@ -58,6 +58,8 @@ endfunction(piglit_include_target_api)
function(piglit_add_executable name)
add_executable(${name} ${ARGV})
add_dependencies(${name} piglit_dispatch_gen)
......@@ -89,3 +91,31 @@ function(piglit_add_library name)
# This is lame, but Windows 10 (and maybe Win8) asks for confirmation
# before running .exe files containing the strings "patch", "setup",
# "update", etc. In Cygwin, we simply get "Permission Denied".
# This causes the Piglit test to fail.
# The work-around is to create a "manifest" file for such executables.
# This function examines the target name and creates the manifest file
# if needed. The file will be named "${target}.exe.manifest".
# See
function(piglit_create_manifest_file target)
if (WIN32)
# look for known strings
string(FIND ${target} "patch" r1)
string(FIND ${target} "setup" r2)
string(FIND ${target} "update" r3)
# if any of those strings is in the target filename
if((${r1} GREATER -1) OR (${r2} GREATER -1) OR (${r3} GREATER -1))
# XXX we should probably use add_custom_command() here to copy
# the manifest file, but I've been unsuccessful in getting
# that to work.
OUTPUT bin/${target}.exe.manifest
INPUT ${CMAKE_SOURCE_DIR}/cmake/win10-manifest.txt)
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- Make sure that UAC believes
that it does not require administrative privilege -->
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment