vista adding manifest problem

Ralf Habacker ralf.habacker at freenet.de
Wed May 13 11:45:39 CEST 2009


Hi,

on vista applications need the following manifest  to be added

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" uiAccess="true"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>

The idea is to add a postbuild task to every executable target by 
creating a macro KDE4_ADD_MANIFEST  like shown below, which is called in 
KDE4_ADD_EXECUTABLE.

macro (KDE4_ADD_MANIFEST _target_NAME)
    get_target_property(_executable ${_target_NAME} LOCATION )
    message(STATUS ${_executable})
    add_custom_command(
        TARGET ${_target_NAME}
        POST_BUILD
        COMMAND ${CMAKE_INSTALL_PREFIX}/bin/mt.exe
        ARGS
           -manifest ${CMAKE_MODULE_PATH}/Win32.Manifest.in
           -updateresource:${_executable}
        COMMENT "adding vista trustInfo manifest to ${_target_NAME}"
   )
endmacro(KDE4_ADD_MANIFEST)


macro (KDE4_ADD_EXECUTABLE _target_NAME)
....
    add_executable(...
....
   IF (WIN32)
       KDE4_ADD_MANIFEST(${_target_NAME})
   ENDIF(WIN32)


This works fine except the cases where the output name of a target is 
changed after the the call to kde4_add_executable like done in kdelibs/kjs

# 'kjs_bin' because cmake doesn't like having a lib and app with the 
same name
kde4_add_executable(kjs_bin NOGUI ${kjs_SRCS})

set_target_properties(kjs_bin PROPERTIES OUTPUT_NAME kjs)

target_link_libraries(kjs_bin ${KJSLIBNAME})

In this case the manifest will be added to the executable named 
kjs_bin.exe, which is wrong.

A solution for this problem would be to call KDE4_ADD_MANIFEST after 
set_target_properties and not in kde4_add_executable, say in a kde 
specific target_link_libraries but there is no 
kde4_target_link_libraries available yet - how to solve this probblem in 
a central place ?

Assumed that there would be a kde4_target_link_libraries macro available 
the next point is that KDE4_ADD_MANIFEST should only be called if the 
target is an executable target not a shared library target. The only way 
I know to detect this case is to check the extension of the target file 
name retrieved with  get_target_property(_executable ${_target_NAME} 
LOCATION ). Is there any other way known ?

Ralf








More information about the Kde-buildsystem mailing list