diff options
author | Ralf Habacker <ralf.habacker@freenet.de> | 2009-05-26 07:43:03 +0000 |
---|---|---|
committer | Ralf Habacker <ralf.habacker@freenet.de> | 2009-05-26 07:43:03 +0000 |
commit | 3708a63008ee9b8cdee6acf24019d76aaa09d372 (patch) | |
tree | ebfa9a93504664719a7ad993ea9bc85634806bc0 /modules | |
parent | 676b6eb8f38dda6355ac8a4264dde149a5470d2c (diff) | |
download | extra-cmake-modules-3708a63008ee9b8cdee6acf24019d76aaa09d372.tar.gz extra-cmake-modules-3708a63008ee9b8cdee6acf24019d76aaa09d372.tar.bz2 |
added initial support for fixing windows vista uac problem by adding a specific manifest file to executables. Vista manifest support is disabled by default and could be enabled by setting the KDE4_ENABLE_UAC_MANIFEST variable. This support requires kdewin32 >= 0.3.9
The basic idea of this patch was announced at kde-buildsystem mailing list http://lists.kde.org/?l=kde-buildsystem&m=124220817129087&w=2 without any objections for about two weeks.
svn path=/trunk/KDE/kdelibs/; revision=972974
Diffstat (limited to 'modules')
-rw-r--r-- | modules/CMakeLists.txt | 28 | ||||
-rw-r--r-- | modules/KDE4Macros.cmake | 49 | ||||
-rw-r--r-- | modules/Win32.Manifest.in | 10 |
3 files changed, 83 insertions, 4 deletions
diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt index 70df69b2..b67e7337 100644 --- a/modules/CMakeLists.txt +++ b/modules/CMakeLists.txt @@ -1,5 +1,23 @@ -## install the cmake files +if (WIN32) + OPTION(KDE4_ENABLE_UAC_MANIFEST "add manifest to make vista uac happy" OFF) + if (KDE4_ENABLE_UAC_MANIFEST) + if (NOT MT_EXECUTABLE) + find_program(MT_EXECUTABLE mt + PATHS ${KDEWIN32_INCLUDE_DIR}/../bin + NO_DEFAULT_PATH + ) + endif (NOT MT_EXECUTABLE) + if (MT_EXECUTABLE) + message(STATUS "Found KDE manifest tool at ${MT_EXECUTABLE} ") + else (MT_EXECUTABLE) + message(STATUS "KDE manifest tool not found, manifest generating for Windows Vista disabled") + set (KDE4_ENABLE_UAC_MANIFEST OFF) + endif (MT_EXECUTABLE) + endif (KDE4_ENABLE_UAC_MANIFEST) +endif (WIN32) +## install the cmake files + file(GLOB cmakeFiles "${CMAKE_CURRENT_SOURCE_DIR}/*.cmake") set(module_install_dir ${DATA_INSTALL_DIR}/cmake/modules ) @@ -15,9 +33,17 @@ install( FILES cmake-modules-styleguide.txt FindPyQt.py FindSIP.py PythonCompile.py + Win32.Manifest.in ${cmakeFiles} DESTINATION ${module_install_dir} ) +if (KDE4_ENABLE_UAC_MANIFEST) + install( FILES cmake-modules-styleguide.txt + Win32.Manifest.in + DESTINATION ${module_install_dir} + ) +endif (KDE4_ENABLE_UAC_MANIFEST) + # the files listed here will be removed by remove_obsoleted_cmake_files.cmake, Alex #set(FILES_TO_REMOVE #) diff --git a/modules/KDE4Macros.cmake b/modules/KDE4Macros.cmake index ce310ebf..eadf5708 100644 --- a/modules/KDE4Macros.cmake +++ b/modules/KDE4Macros.cmake @@ -30,7 +30,6 @@ # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. - # This is for versions of automoc4 which don't provide these two macros. # If such a version is used, just use the "old" style automoc handling. if(NOT COMMAND _AUTOMOC4_KDE4_PRE_TARGET_HANDLING) @@ -791,6 +790,47 @@ macro (KDE4_ADD_UNIT_TEST _test_NAME) endmacro (KDE4_ADD_UNIT_TEST) +# add a manifest file to executables. This macro is used by kde4_add_executable +# +# In cmake <= 2.6.4 there is a bug which returns a wrong path from +# get_target_property(var <target_name> LOCATION), when the +# OUTPUT_NAME property of a target is set before. +# +# To workaround those cases a specific variable should be set before +# calling kde4_add_executable as shown by the following example: +# +# set(xyz_OUTPUT_NAME test) +# kde4_add_executable( xyz <source>) +# set_target_properties( xyz PROPERTIES OUTPUT_NAME ${xyz_OUTPUT_NAME} ) +# +macro (KDE4_ADD_MANIFEST _target_NAME) + set(x ${_target_NAME}_OUTPUT_NAME) + if (${x}) + set (_executable ${_target_NAME}_LOCATION) + else(${x}) + get_target_property(_executable ${_target_NAME} LOCATION ) + endif(${x}) + + if (_kdeBootStrapping) + set(_cmake_module_path ${CMAKE_SOURCE_DIR}/cmake/modules) + else (_kdeBootStrapping) + set(_cmake_module_path ${KDE4_INSTALL_DIR}/share/apps/cmake/modules) + endif (_kdeBootStrapping) + + set(_manifest ${_cmake_module_path}/Win32.Manifest.in) + #message(STATUS ${_executable} ${_manifest}) + add_custom_command( + TARGET ${_target_NAME} + POST_BUILD + COMMAND ${MT_EXECUTABLE} + ARGS + -manifest ${_manifest} + -updateresource:${_executable} + COMMENT "adding vista trustInfo manifest to ${_target_NAME}" + ) +endmacro(KDE4_ADD_MANIFEST) + + macro (KDE4_ADD_EXECUTABLE _target_NAME) kde4_check_executable_params( _SRCS _nogui _uninst _test ${ARGN}) @@ -823,7 +863,7 @@ macro (KDE4_ADD_EXECUTABLE _target_NAME) endif (_test AND NOT KDE4_BUILD_TESTS) _automoc4_kde4_pre_target_handling(${_target_NAME} _SRCS) - + if (KDE4_ENABLE_FINAL) kde4_create_final_files(${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_final_cpp.cpp _separate_files ${_SRCS}) add_executable(${_target_NAME} ${_add_executable_param} ${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_final_cpp.cpp ${_separate_files}) @@ -831,6 +871,10 @@ macro (KDE4_ADD_EXECUTABLE _target_NAME) add_executable(${_target_NAME} ${_add_executable_param} ${_SRCS}) endif (KDE4_ENABLE_FINAL) + IF (KDE4_ENABLE_UAC_MANIFEST) + KDE4_ADD_MANIFEST(${_target_NAME}) + ENDIF(KDE4_ENABLE_UAC_MANIFEST) + _automoc4_kde4_post_target_handling(${_target_NAME}) if (_test) @@ -896,7 +940,6 @@ macro (KDE4_ADD_LIBRARY _target_NAME _lib_TYPE) endmacro (KDE4_ADD_LIBRARY _target_NAME _lib_TYPE) - macro (KDE4_ADD_WIDGET_FILES _sources) foreach (_current_FILE ${ARGN}) diff --git a/modules/Win32.Manifest.in b/modules/Win32.Manifest.in new file mode 100644 index 00000000..f8d7ba4f --- /dev/null +++ b/modules/Win32.Manifest.in @@ -0,0 +1,10 @@ +<?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> |