Commit 75410802 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

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
parent 602d3daf
......@@ -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:$<TARGET_FILE:mariadb-upgrade-wizard>;#1"
SET_TARGET_PROPERTIES(mariadb-upgrade-wizard PROPERTIES
WIN32_EXECUTABLE 1
LINK_FLAGS "/MANIFESTUAC:level='requireAdministrator'"
)
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