From 754108021415ee718087b004a49bd54bd31cf6ad Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Wed, 12 Aug 2020 21:18:21 +0200 Subject: MDEV-23461 mysql_upgrade_wizard.exe differs from mariadb-upgrade-wizard.exe The post-build custom command to embed Vista elevation manifest into mariadb-upgrade-wizard.exe seems to do something nasty to the executable, perhaps it removes and recreates it. Thus the previously created hardlink mysql_upgrade_wizard is not marked to require elevation. Solved by using MANIFESTUAC linker flag, rather than invoke mt.exe. This avoids an extra post-build step that modifies mariadb-upgrade-wizard.exe --- win/upgrade_wizard/CMakeLists.txt | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/win/upgrade_wizard/CMakeLists.txt b/win/upgrade_wizard/CMakeLists.txt index 5a98ab15d0f..20a06a41215 100644 --- a/win/upgrade_wizard/CMakeLists.txt +++ b/win/upgrade_wizard/CMakeLists.txt @@ -35,17 +35,12 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/sql) MYSQL_ADD_EXECUTABLE(mariadb-upgrade-wizard upgrade.cpp upgradeDlg.cpp upgrade.rc ${UPGRADE_WIZARD_SOURCES} COMPONENT Server) + + TARGET_LINK_LIBRARIES(mariadb-upgrade-wizard ${UPGRADE_WIZARD_LINK_LIBRARIES}) # upgrade_wizard is Windows executable, set WIN32_EXECUTABLE so it does not # create a console. -SET_TARGET_PROPERTIES(mariadb-upgrade-wizard PROPERTIES WIN32_EXECUTABLE 1) - -# Embed Vista "admin" manifest, since upgrade_wizard needs admin privileges -# to change service configuration. Due to a CMake bug http://www.vtk.org/Bug/view.php?id=11171 -# it is not possible currenly to do it with linker flags. Work around is to use -# manifest tool mt.exe and embed the manifest post-build. -ADD_CUSTOM_COMMAND( - TARGET mariadb-upgrade-wizard POST_BUILD - COMMAND mt.exe -manifest ${CMAKE_CURRENT_SOURCE_DIR}/upgrade_wizard.exe.manifest - "-outputresource:$;#1" +SET_TARGET_PROPERTIES(mariadb-upgrade-wizard PROPERTIES + WIN32_EXECUTABLE 1 + LINK_FLAGS "/MANIFESTUAC:level='requireAdministrator'" ) -- cgit v1.2.1