From a54169789d2eaffd83fa121d092e1af755c2a968 Mon Sep 17 00:00:00 2001 From: David Cole Date: Tue, 11 Sep 2007 15:21:37 -0400 Subject: [PATCH] ENH: Avoid prompting for admin privileges when running CMakeSetup.exe on Vista by adding a requestedExecutionLevel element to its manifest. --- CTestCustom.cmake.in | 3 +-- Source/MFCDialog/CMakeLists.txt | 19 +++++++++++++++++++ Source/MFCDialog/CMakeSetupManifest.xml | 10 ++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 Source/MFCDialog/CMakeSetupManifest.xml diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in index f6640f3ac..bdd75245c 100644 --- a/CTestCustom.cmake.in +++ b/CTestCustom.cmake.in @@ -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") - diff --git a/Source/MFCDialog/CMakeLists.txt b/Source/MFCDialog/CMakeLists.txt index 060509fa4..ae9fc3765 100644 --- a/Source/MFCDialog/CMakeLists.txt +++ b/Source/MFCDialog/CMakeLists.txt @@ -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) diff --git a/Source/MFCDialog/CMakeSetupManifest.xml b/Source/MFCDialog/CMakeSetupManifest.xml new file mode 100644 index 000000000..1a662f34a --- /dev/null +++ b/Source/MFCDialog/CMakeSetupManifest.xml @@ -0,0 +1,10 @@ + + + + + + + + + +