View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0011171CMakeCMakepublic2010-08-25 10:122016-06-10 14:31
ReporterSteven Taylor 
Assigned ToBill Hoffman 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionmoved 
PlatformOSOS Version
Product VersionCMake-2-8 
Target VersionFixed in Version 
Summary0011171: Visual Studio 10 solution generation is incorrect
DescriptionI am adding the following to my cmake files to update the manifest with the correct UAC requirements for my exe

SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MANIFESTUAC:\"level='requireAdministrator' uiAccess='false'\" /SUBSYSTEM:WINDOWS" )

But what I see in the generated solution files is
    <Link>
      <AdditionalOptions> /machine:X86 /debug %(AdditionalOptions)</AdditionalOptions>
      <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib</AdditionalDependencies>
      <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
      <EnableUAC>true</EnableUAC>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <ImportLibrary>C:/Development/cmake/test/vs/Debug/HelloWorld.lib</ImportLibrary>
      <ProgramDataBaseFileName>C:/Development/cmake/test/vs/Debug/HelloWorld.pdb</ProgramDataBaseFileName>
      <StackReserveSize>10000000</StackReserveSize>
      <SubSystem>Console</SubSystem>
      <UACUIAccess>level='requireAdministrator' uiAccess='false'</UACUIAccess>
      <Version>0.0</Version>
    </Link>

and DevStudio 10 complains about

<UACUIAccess>level='requireAdministrator' uiAccess='false'</UACUIAccess>

What I expected to see was

    <Link>
      <AdditionalOptions>
      </AdditionalOptions>
      <SubSystem>Console</SubSystem>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <EnableUAC>true</EnableUAC>
      <UACUIAccess>false</UACUIAccess>
      <UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
    </Link>

But cannot generate it.

This looks like a bug in the generation code and the only workaround I can see is comment out the MANIFESTUAC entries in the cmVS10LinkFlagTable.h file. Is this a bug or am I missing something?
TagsNo tags attached.
Attached Filespatch file icon Bug-0011171-sub-topic-SUBSYSTEM-WINDOWS-linker-flag.patch [^] (1,769 bytes) 2010-10-18 16:03 [Show Content]

 Relationships
related to 0010704closedDavid Cole don't GenerateManifest flag (/Manifest:NO) doesn't work with VS 2010 
related to 0011216closedDavid Cole Link with /MANIFEST even /manifest:no was set 
related to 0012566closedKitware Robot REGRESSION: CMake suppresses /SUBSYSTEM linker flag 

  Notes
(0022001)
Strahinja Markovic (reporter)
2010-08-29 12:35
edited on: 2010-08-29 12:37

I have the same issue. I'm trying to pass the "/SUBSYSTEM:WINDOWS" option to the linker using this:

set_target_properties( ${PROJECT_NAME} PROPERTIES LINK_FLAGS "/SUBSYSTEM:WINDOWS" )

and it works for NMake makefiles and vs2008 project files, but not for the vs2010 project files. The subsystem stays CONSOLE.

(0022413)
Denis Rotnov (reporter)
2010-10-05 23:47

I have excatly same issue like Steven Taylor.
CMake script

-------------------------------------------------------------------------------
AUX_SOURCE_DIRECTORY(src SRC)
INCLUDE_DIRECTORIES(include)

SET(SRC ${SRC} "res/web-loader.rc")

SET(TARGET_NAME "web-loader")

ADD_EXECUTABLE(${TARGET_NAME} WIN32 ${SRC})

TARGET_LINK_LIBRARIES("${TARGET_NAME}" wininet shlwapi Shell32 comctl32 strsafe)
SET_TARGET_PROPERTIES("${TARGET_NAME}" PROPERTIES LINK_FLAGS "/MANIFESTUAC:\"level='requireAdministrator' uiAccess='true'\"")

-------------------------------------------------------------------------------

As result VS 10 grenerates error
-------------------------------------------------------------------------------
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\Microsoft.Cpp.Win32.Targets(353,9): error MSB4030: "level='requireAdministrator' uiAccess='true'" is an invalid value for the "UACUIAccess" parameter of the "Link" task. The "UACUIAccess" parameter is of type "System.Boolean".
-------------------------------------------------------------------------------

Is any workaround to avoid this problem?

Thanks
(0022465)
McBen (reporter)
2010-10-10 07:55

@Strahinja Markovic
subsystem is defined by the "WIN32_EXECUTABLE" property.
or quickly by the WIN32 in "ADD_EXECUTABLE(${TARGET_NAME} WIN32 ${SRC})"
(0022466)
Strahinja Markovic (reporter)
2010-10-10 08:09

@McBen Thanks for that. I was told to do it like this a long time ago, and it worked for years. Good to know there's a better way to do it.
(0022518)
abubadabu (reporter)
2010-10-18 09:14

@McBen But this kills the feature for us to do a console app for debug- and a windowed for release-build :(

Before (vs 2005/2008) you could overwrite the WIN32 flag from add_executable by setting the target_properties to subsystem:console.

There is no way to do both:
- ADD_EXECUTABLE_RELEASE(${TARGET_NAME} WIN32 ${SRC})
- ADD_EXECUTABLE_DEBUG(${TARGET_NAME} ${SRC})
(0022527)
McBen (reporter)
2010-10-18 16:03

yes, that's true. But that wasn't requested above.
And I wouldn't do such thinks because I want the debug-version as near as possible to the release version...anyway..I bet you'll have a good reason to do so.

I added a patch for that
(it'll change the order how manual linker flags and WIN32_EXECUTABLE are processed)

BUT: this has nothing to do with the reported bug here !!
(0023065)
goatboy160 (reporter)
2010-11-08 14:30

For the execution level I added this to cmVS10LinkFlagTable.h. Not perfect but works.

{"UACUIAccess", "MANIFESTUAC:", "Enable User Account Control (UAC)", "",
   cmVS7FlagTable::UserValueRequired},
+ {"UACExecutionLevel", "UACEXECUTIONLEVEL:", "Modify Execution Level",
+ "RequireAdministrator",
+ cmVS7FlagTable::UserValueRequired},
  {"GenerateMapFile", "MAP", "", "true",
   cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
(0026596)
David Cole (manager)
2011-05-25 17:03

Not for 2.8.5 - postponing until a future release
(0027057)
Timothy St. Clair (reporter)
2011-07-20 15:11

This is a pretty serious issue that appears to be lingering and I just hit. Request a bump in priority.
(0027271)
ae (reporter)
2011-08-25 09:01

Could you at least provide a workaround until this gets usable with vs 2010?
(0027272)
Bill Hoffman (manager)
2011-08-25 09:29
edited on: 2011-08-25 11:31

If there was a workable patch we could get this into 2.8.6. Anyone have an idea? "For the execution level I added this to cmVS10LinkFlagTable.h. Not perfect but works." Does that patch work?

(0027740)
Gili (reporter)
2011-11-09 19:42

I've filed a separate bug report for the /SUBSYSTEM bug at http://public.kitware.com/Bug/view.php?id=12566 [^]
(0028426)
Fraser Hutchison (reporter)
2012-01-30 15:34

A workaround for just the UAC issue is to declare the link flags separately. I believe this only works for VS2010.

Replace:
SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MANIFESTUAC:\"level='requireAdministrator' uiAccess='false'\"" )

with:
SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /level='requireAdministrator' /uiAccess='false'" )
(0041742)
Kitware Robot (administrator)
2016-06-10 14:28

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2010-08-25 10:12 Steven Taylor New Issue
2010-08-29 12:35 Strahinja Markovic Note Added: 0022001
2010-08-29 12:37 Strahinja Markovic Note Edited: 0022001
2010-10-05 23:47 Denis Rotnov Note Added: 0022413
2010-10-10 07:55 McBen Note Added: 0022465
2010-10-10 08:09 Strahinja Markovic Note Added: 0022466
2010-10-18 09:14 abubadabu Note Added: 0022518
2010-10-18 16:03 McBen Note Added: 0022527
2010-10-18 16:03 McBen File Added: Bug-0011171-sub-topic-SUBSYSTEM-WINDOWS-linker-flag.patch
2010-11-08 14:30 goatboy160 Note Added: 0023065
2010-12-15 11:49 David Cole Assigned To => Bill Hoffman
2010-12-15 11:49 David Cole Status new => assigned
2011-02-08 12:16 David Cole Relationship added related to 0010704
2011-02-08 12:16 David Cole Relationship added related to 0011216
2011-04-14 14:31 David Cole Target Version => CMake 2.8.5
2011-05-25 17:03 David Cole Note Added: 0026596
2011-05-25 17:03 David Cole Target Version CMake 2.8.5 =>
2011-07-20 15:11 Timothy St. Clair Note Added: 0027057
2011-08-25 09:01 ae Note Added: 0027271
2011-08-25 09:29 Bill Hoffman Note Added: 0027272
2011-08-25 11:31 David Cole Note Edited: 0027272
2011-11-09 19:42 Gili Note Added: 0027740
2011-11-10 11:10 David Cole Relationship added related to 0012566
2012-01-30 15:34 Fraser Hutchison Note Added: 0028426
2016-06-10 14:28 Kitware Robot Note Added: 0041742
2016-06-10 14:28 Kitware Robot Status assigned => resolved
2016-06-10 14:28 Kitware Robot Resolution open => moved
2016-06-10 14:31 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team