ENH: Avoid prompting for admin privileges when running CMakeSetup.exe on Vista by adding a requestedExecutionLevel element to its manifest.

This commit is contained in:
David Cole 2007-09-11 15:21:37 -04:00
parent 1f99030cfa
commit a54169789d
3 changed files with 30 additions and 2 deletions

View File

@ -22,9 +22,9 @@ SET(CTEST_CUSTOM_WARNING_EXCEPTION
"Clock skew detected"
"remark\\(1209"
"stl_deque.h:1051"
"CMakeSetupManifest.xml.*manifest authoring warning.*Unrecognized Element"
)
IF(NOT "@CMAKE_GENERATOR@" MATCHES "Xcode")
SET(CTEST_CUSTOM_COVERAGE_EXCLUDE
${CTEST_CUSTOM_COVERAGE_EXCLUDE}
@ -38,4 +38,3 @@ IF(NOT "@CMAKE_GENERATOR@" MATCHES "KDevelop")
"Kdevelop"
)
ENDIF (NOT "@CMAKE_GENERATOR@" MATCHES "KDevelop")

View File

@ -30,4 +30,23 @@ SET(CMAKE_MFC_FLAG 2)
ADD_EXECUTABLE(CMakeSetup WIN32 ${SRCS})
TARGET_LINK_LIBRARIES(CMakeSetup CMakeLib)
ADD_DEPENDENCIES(CMakeSetup cmake)
IF(MSVC AND NOT MSVC60 AND NOT MSVC70 AND NOT MSVC71)
SET(exe "${CMAKE_CFG_INTDIR}/CMakeSetup.exe")
IF(EXECUTABLE_OUTPUT_PATH)
SET(exe "${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/CMakeSetup.exe")
ENDIF(EXECUTABLE_OUTPUT_PATH)
# Solve the "things named like *Setup prompt for admin privileges
# on Vista" problem by merging a manifest fragment that contains a
# requestedExecutionLevel element:
#
ADD_CUSTOM_COMMAND(TARGET CMakeSetup
POST_BUILD COMMAND mt
"-inputresource:${exe};#1"
-manifest "${CMAKE_CURRENT_SOURCE_DIR}/CMakeSetupManifest.xml"
"-outputresource:${exe};#1"
)
ENDIF(MSVC AND NOT MSVC60 AND NOT MSVC70 AND NOT MSVC71)
INSTALL_TARGETS(/bin CMakeSetup)

View File

@ -0,0 +1,10 @@
<?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">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>