Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CMake RequireAdministrator

I'm trying to set the RequireAdministrator manifest flag on an executable I'm building with CMake and Visual Studio.

Any ideas on how to direct CMake to set that option?

Thanks!

Billy3

like image 716
Billy ONeal Avatar asked Oct 31 '09 17:10

Billy ONeal


3 Answers

I appreciate that the question is tagged visual-studio-2008, but for VS2010 this produces the following error message:

error MSB4030: "level='requireAdministrator' uiAccess='false'" is an invalid value for the "UACUIAccess" parameter of the "Link" task. The "UACUIAccess" parameter is of type "System.Boolean".

An equivalent CMake command (disregarding the /SUBSYSTEM:WINDOWS portion) for VS2010 is

SET_TARGET_PROPERTIES(your_executable PROPERTIES LINK_FLAGS "/level='requireAdministrator' /uiAccess='false'")
like image 187
Fraser Avatar answered Nov 15 '22 06:11

Fraser


try this:

SET_TARGET_PROPERTIES(your_executable PROPERTIES LINK_FLAGS    "/MANIFESTUAC:\"level='requireAdministrator' uiAccess='false'\" /SUBSYSTEM:WINDOWS")
like image 39
Nadir SOUALEM Avatar answered Nov 15 '22 05:11

Nadir SOUALEM


If it is a console app, you need to remove the "/SUBSYSTEM:WINDOWS".

try this:

set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS " /MANIFESTUAC:\"level='requireAdministrator' uiAccess='false'\" ")
like image 1
hui-shao Avatar answered Nov 15 '22 07:11

hui-shao