diff options
| author | Patrick Spendrin <ps_ml@gmx.de> | 2007-12-30 19:22:03 +0000 | 
|---|---|---|
| committer | Patrick Spendrin <ps_ml@gmx.de> | 2007-12-30 19:22:03 +0000 | 
| commit | 5abf40e617feef164adf4e3b876c1dfb793107e8 (patch) | |
| tree | 6d8ec02b512cb9d674a7e2731b68954e3822b857 /modules/KDE4Macros.cmake | |
| parent | 5b33917e39567492e7bb49fcc2ce90f6939f9ef5 (diff) | |
| download | extra-cmake-modules-5abf40e617feef164adf4e3b876c1dfb793107e8.tar.gz extra-cmake-modules-5abf40e617feef164adf4e3b876c1dfb793107e8.tar.bz2 | |
change KDE4_ADD_APP_ICON to act exactly like KDE4_ADD_WIN32_APP_ICON as the former did not work correct / was to unflexible
CCMAIL: Ralf.Habacker@freenet.de
svn path=/trunk/KDE/kdelibs/; revision=754803
Diffstat (limited to 'modules/KDE4Macros.cmake')
| -rw-r--r-- | modules/KDE4Macros.cmake | 78 | 
1 files changed, 32 insertions, 46 deletions
| diff --git a/modules/KDE4Macros.cmake b/modules/KDE4Macros.cmake index 3188a856..22b6a707 100644 --- a/modules/KDE4Macros.cmake +++ b/modules/KDE4Macros.cmake @@ -986,12 +986,13 @@ endmacro (KDE4_ADD_WIN32_APP_ICON)  # mac osx notes : the application icon is added to a Mac OS X bundle so that Finder and friends show the right thing.  # win32 notes: the application icon(s) are compiled into the application   # parameters:  -# 'target'      - cmake target to generate   # 'appsources'  - specifies the list of source files  -# 'pattern'     - regular expression for searching application icons  -# example: KDE4_ADD_APP_ICON(myapp myapp_sources "pics/cr*-myapp.png") +# 'pngfiles' - specifies the list of icon files +# example: KDE4_ADD_APP_ICON( myapp_sources myapp_icons) +#          where blinken_icons is a list of png icons -macro (KDE4_ADD_APP_ICON target appsources pattern ) +macro (KDE4_ADD_APP_ICON appsources ) +    STRING(REPLACE _SRCS "" target ${appsources})      if (WIN32)          find_program(PNG2ICO_EXECUTABLE NAMES png2ico)          find_program(WINDRES_EXECUTABLE NAMES windres) @@ -999,40 +1000,23 @@ macro (KDE4_ADD_APP_ICON target appsources pattern )              set(WINDRES_EXECUTABLE TRUE)          endif(MSVC)                  if (PNG2ICO_EXECUTABLE AND WINDRES_EXECUTABLE) -            file(GLOB files  "${pattern}") -            FOREACH (it ${files}) -                GET_FILENAME_COMPONENT(_name ${it} NAME_WE) -                if (it MATCHES ".*16-.*" ) -                    list (APPEND _icons ${it}) -                endif (it MATCHES ".*16-.*") -                if (it MATCHES ".*32-.*" ) -                    list (APPEND _icons ${it}) -                endif (it MATCHES ".*32-.*") -                if (it MATCHES ".*64-.*" ) -                    list (APPEND _icons ${it}) -                endif (it MATCHES ".*64-.*") -            ENDFOREACH (it) -            if (_icons) -	            set (_outfilename ${CMAKE_CURRENT_BINARY_DIR}/${target}) -	            # requires kdewin32 >= 0.3.4 -	            ADD_CUSTOM_COMMAND(OUTPUT ${_outfilename}.ico ${_outfilename}.rc -	                               COMMAND ${PNG2ICO_EXECUTABLE} ARGS --rcfile ${_outfilename}.rc ${_outfilename}.ico ${_icons} -	                               DEPENDS ${PNG2ICO_EXECUTABLE} ${ARGN} -	                               WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} -	                              ) -	            if (MINGW) -	                ADD_CUSTOM_COMMAND(OUTPUT ${_outfilename}_res.o -	                                   COMMAND ${WINDRES_EXECUTABLE} ARGS -i ${_outfilename}.rc -o ${_outfilename}_res.o --include-dir=${CMAKE_CURRENT_SOURCE_DIR} -	                                   DEPENDS ${WINDRES_EXECUTABLE} ${_outfilename}.rc -	                                   WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} -	                                  ) -	                list(APPEND ${appsources} ${_outfilename}_res.o) -	            else(MINGW) -	                list(APPEND ${appsources} ${_outfilename}.rc) -	            endif(MINGW) -            else(_icons) -                message(STATUS "Unable to find a related icon for target ${target} - application will not have an application icon!") -            endif(_icons) +            set (_outfilename ${CMAKE_CURRENT_BINARY_DIR}/${target}) +            # requires kdewin32 >= 0.3.4 +            ADD_CUSTOM_COMMAND(OUTPUT ${_outfilename}.ico ${_outfilename}.rc +                               COMMAND ${PNG2ICO_EXECUTABLE} ARGS --rcfile ${_outfilename}.rc ${_outfilename}.ico ${ARGN} +                               DEPENDS ${PNG2ICO_EXECUTABLE} ${ARGN} +                               WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +                              ) +            if (MINGW) +                ADD_CUSTOM_COMMAND(OUTPUT ${_outfilename}_res.o +                                   COMMAND ${WINDRES_EXECUTABLE} ARGS -i ${_outfilename}.rc -o ${_outfilename}_res.o --include-dir=${CMAKE_CURRENT_SOURCE_DIR} +                                   DEPENDS ${WINDRES_EXECUTABLE} ${_outfilename}.rc +                                   WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +                                  ) +                list(APPEND ${appsources} ${_outfilename}_res.o) +            else(MINGW) +                list(APPEND ${appsources} ${_outfilename}.rc) +            endif(MINGW)          else(PNG2ICO_EXECUTABLE AND WINDRES_EXECUTABLE)              message(STATUS "Unable to find the png2ico or windres utilities - application will not have an application icon!")          endif(PNG2ICO_EXECUTABLE AND WINDRES_EXECUTABLE) @@ -1040,11 +1024,13 @@ macro (KDE4_ADD_APP_ICON target appsources pattern )      if (Q_WS_MAC)          # first convert image to a tiff using the Mac OS X "sips" utility,          # then use tiff2icns to convert to an icon +                  find_program(SIPS_EXECUTABLE NAMES sips)          find_program(TIFF2ICNS_EXECUTABLE NAMES tiff2icns)          if (SIPS_EXECUTABLE AND TIFF2ICNS_EXECUTABLE)              file(GLOB files  "${pattern}") -            FOREACH (it ${files}) +            # we can only test for the 128-icon like that - we don't use patterns anymore +            FOREACH (it ${ARGN})                  if (it MATCHES ".*128-.*" )                      set (_icon ${it})                  endif (it MATCHES ".*128-.*") @@ -1055,12 +1041,12 @@ macro (KDE4_ADD_APP_ICON target appsources pattern )                  # first, get the basename of our app icon                  add_custom_command(OUTPUT ${_outfilename}.icns -                                   COMMAND sips -s format tiff ${_icon} --out _tmp_appicon.tiff -                                   COMMAND tiff2icns _tmp_appicon.tiff ${_outfilename}.icns +                                   COMMAND ${SIPS_EXECUTABLE} -s format tiff ${_icon} --out ${outfilename}.tiff +                                   COMMAND ${TIFF2ICNS_EXECUTABLE} ${outfilename}.tiff ${_outfilename}.icns                                     DEPENDS ${_icon}                                     ) -                macro_additional_clean_files(_tmp_appicon.tiff ${_outfilename}.icns) +                macro_additional_clean_files(${outfilename}.tiff ${_outfilename}.icns)                  # This will register the icon into the bundle                  set(MACOSX_BUNDLE_ICON_FILE ${target}.icns) @@ -1074,10 +1060,10 @@ macro (KDE4_ADD_APP_ICON target appsources pattern )                  install(FILES ${_outfilename}.icns DESTINATION ${BIN_INSTALL_DIR}/${target}.app/Contents/Resources/) -                else(_icon) -                    # TODO - try to scale a non-128 icon...? Try to convert an SVG on the fly? -                    message(STATUS "Unable to find an 128x128 icon for target ${target} - application will not have an application icon!") -                endif(_icon) +            else(_icon) +                # TODO - try to scale a non-128 icon...? Try to convert an SVG on the fly? +                message(STATUS "Unable to find an 128x128 icon for target ${target} - application will not have an application icon!") +            endif(_icon)          else(SIPS_EXECUTABLE AND TIFF2ICNS_EXECUTABLE)              message(STATUS "Unable to find the sips and tiff2icns utilities - application will not have an application icon!") | 
