File 0001-Exclude-kconf_update-from-being-catched-by-uac-on-Wind.txt of Package mingw64-kdelibs4
From c2eb9ed55b303250d4ad32d8e512333d59286572 Mon Sep 17 00:00:00 2001
From: Ralf Habacker <ralf.habacker@freenet.de>
Date: Tue, 5 Sep 2017 08:12:33 +0200
Subject: [PATCH] Exclude kconf_update from being catched by uac on Windows
FIXED-IN:4.14.36
BUG:384334
---
cmake/modules/Win32Macros.cmake | 28 ++++++++++++++++++++++++++++
kconf_update/CMakeLists.txt | 3 +++
2 files changed, 31 insertions(+)
diff --git a/cmake/modules/Win32Macros.cmake b/cmake/modules/Win32Macros.cmake
index e5a3655b01..091f70d68a 100644
--- a/cmake/modules/Win32Macros.cmake
+++ b/cmake/modules/Win32Macros.cmake
@@ -44,4 +44,32 @@ if (WIN32)
endif (CMAKE_BUILD_TOOL STREQUAL "nmake")
endif (MINGW)
ENDMACRO (addExplorerWrapper)
+
+ #
+ # Set execution level for a target to 'asInvoker'
+ #
+ # Syntax:
+ # set_execution_level_as_invoker(_source)
+ #
+ # @param _source name of source list for a given target
+ #
+ # Example:
+ # set (SOURCE test.c)
+ # set_execution_level_as_invoker(SOURCE)
+ # add_executable(atarget, ${SOURCE})
+ #
+ MACRO (set_execution_level_as_invoker _source)
+ # set uiaccess to false in manifest
+ file(READ ${CMAKE_SOURCE_DIR}/cmake/modules/Win32.Manifest.in _tmp)
+ string(REPLACE "true" "false" _out ${_tmp})
+ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${_source}.Win32.Manifest ${_out})
+ # create rc file
+ # 1 is the resource ID, ID_MANIFEST
+ # 24 is the resource type, RT_MANIFEST
+ # constants are used because of a bug in windres
+ # see https://stackoverflow.com/questions/33000158/embed-manifest-file-to-require-administrator-execution-level-with-mingw32
+ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${_source}.rc "1 24 \"${CMAKE_CURRENT_BINARY_DIR}/${_source}.Win32.Manifest\"\n")
+ # add to source list
+ list(APPEND ${_source} ${CMAKE_CURRENT_BINARY_DIR}/${_source}.rc)
+ ENDMACRO (set_execution_level_as_invoker)
endif(WIN32)
diff --git a/kconf_update/CMakeLists.txt b/kconf_update/CMakeLists.txt
index 6bf3bf1f92..49d2b37a91 100644
--- a/kconf_update/CMakeLists.txt
+++ b/kconf_update/CMakeLists.txt
@@ -11,6 +11,9 @@ set(kconf_update_KDEINIT_SRCS
kconfigutils.cpp
)
+if(WIN32)
+ set_execution_level_as_invoker(kconf_update_KDEINIT_SRCS)
+endif()
kde4_add_kdeinit_executable( kconf_update NOGUI ${kconf_update_KDEINIT_SRCS})
--
2.12.3