Reputation: 457
I want to build a window application that needs administrator privileges with CMake . I try add "/MANIFESTUAC:\"level='requireAdministrator' uiAccess='false'\" /SUBSYSTEM:WINDOWS" , but it not work
Environment: Windows10
IDE: VS2017
CMAKE : default with VS2017,version 3.12.18081601-MSVC_2
add_executable(MSP_D WIN32 ${MSP_D_SRC} msp_d.rc)
SET_TARGET_PROPERTIES(MSP_D PROPERTIES LINK_FLAGS "/MANIFESTUAC:\"level='requireAdministrator' uiAccess='false'\" /SUBSYSTEM:WINDOWS")
How to solve this ?How to get my purpose? Any suggestion will be appreciated.
Upvotes: 3
Views: 4852
Reputation: 1033
You should use something like this. You may need to change subsystem based on your project type.
SET_TARGET_PROPERTIES(MSP PROPERTIES LINK_FLAGS "/MANIFESTUAC:\"level='requireAdministrator' uiAccess='false'\" /SUBSYSTEM:WINDOWS")
Upvotes: 5