diff options
author | Sjors Gielen <dazjorz@dazjorz.com> | 2010-07-06 13:17:04 +0000 |
---|---|---|
committer | Sjors Gielen <dazjorz@dazjorz.com> | 2010-07-06 13:17:04 +0000 |
commit | 3f5eb85b639506904ae8a3ee2eaa20518ee55578 (patch) | |
tree | 34a171c48f818095c325bc2a5c72a86e07fa91cf | |
parent | 41d23fc4e6ce5eefdae075804fe27c7c0bf2bb0d (diff) | |
download | extra-cmake-modules-3f5eb85b639506904ae8a3ee2eaa20518ee55578.tar.gz extra-cmake-modules-3f5eb85b639506904ae8a3ee2eaa20518ee55578.tar.bz2 |
Fix target name assumption in KDE4_ADD_APP_ICON together with Alex
Made error messages and variables in that macro be more clear, and fixed the documentation to reflect that
svn path=/trunk/KDE/kdelibs/; revision=1146718
-rw-r--r-- | modules/FindKDE4Internal.cmake | 8 | ||||
-rw-r--r-- | modules/KDE4Macros.cmake | 26 |
2 files changed, 13 insertions, 21 deletions
diff --git a/modules/FindKDE4Internal.cmake b/modules/FindKDE4Internal.cmake index c9e8892f..25a3e914 100644 --- a/modules/FindKDE4Internal.cmake +++ b/modules/FindKDE4Internal.cmake @@ -233,14 +233,14 @@ # # KDE4_ADD_APP_ICON (SRCS_VAR pattern) # adds an application icon to target source list. +# Make sure you have a 128x128 icon, or the icon won't display on Mac OS X. # 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 # There is some workaround in kde4_add_kdeinit_executable to make it possible for those applications as well. # Parameters: -# SRCS_VAR - specifies the list of source files; this has to end in _SRCS or _KDEINIT_SRCS -# (see the replace stuff below) -# pattern - regular expression for searching application icons -# Example: KDE4_ADD_APP_ICON( myapp_SRCS "pics/cr*-myapp.png") +# SRCS_VAR - specifies the list of source files +# pattern - regular expression for searching application icons +# Example: KDE4_ADD_APP_ICON( myapp_SOURCES "pics/cr*-myapp.png") # Example: KDE4_ADD_APP_ICON( myapp_KDEINIT_SRCS "icons/oxygen/*/apps/myapp.png") # # KDE4_UPDATE_ICONCACHE() diff --git a/modules/KDE4Macros.cmake b/modules/KDE4Macros.cmake index 16bc0217..93d18598 100644 --- a/modules/KDE4Macros.cmake +++ b/modules/KDE4Macros.cmake @@ -1121,13 +1121,10 @@ macro (KDE4_ADD_WIN32_APP_ICON appsources) endmacro (KDE4_ADD_WIN32_APP_ICON) # adds application icon to target source list -# for detailled documentation see the top of FindKDE4Internal.cmake +# for detailed documentation see the top of FindKDE4Internal.cmake macro (KDE4_ADD_APP_ICON appsources pattern) - string(REPLACE _KDEINIT_SRCS "" target ${appsources}) - if(${appsources} STREQUAL ${target}) - string(REPLACE _SRCS "" target ${appsources}) - endif(${appsources} STREQUAL ${target}) - + set (_outfilename ${CMAKE_CURRENT_BINARY_DIR}/${appsources}) + if (WIN32) find_program(PNG2ICO_EXECUTABLE NAMES png2ico) find_program(WINDRES_EXECUTABLE NAMES windres) @@ -1156,7 +1153,6 @@ macro (KDE4_ADD_APP_ICON appsources pattern) endif (fn MATCHES ".*128.*") endforeach (it) if (_icons) - set (_outfilename ${CMAKE_CURRENT_BINARY_DIR}/${target}) add_custom_command(OUTPUT ${_outfilename}.ico ${_outfilename}.rc COMMAND ${PNG2ICO_EXECUTABLE} ARGS --rcfile ${_outfilename}.rc ${_outfilename}.ico ${_icons} DEPENDS ${PNG2ICO_EXECUTABLE} ${_icons} @@ -1173,7 +1169,7 @@ macro (KDE4_ADD_APP_ICON appsources pattern) 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!") + message(STATUS "Unable to find a related icon that matches pattern ${pattern} for variable ${appsources} - application will not have an application icon!") endif(_icons) else(PNG2ICO_EXECUTABLE AND WINDRES_EXECUTABLE) message(STATUS "Unable to find the png2ico or windres utilities - application will not have an application icon!") @@ -1192,7 +1188,6 @@ macro (KDE4_ADD_APP_ICON appsources pattern) set (_icon ${it}) endif (it MATCHES ".*128.*") endforeach (it) - set (_outfilename ${CMAKE_CURRENT_BINARY_DIR}/${target}) if (_icon) @@ -1204,27 +1199,24 @@ macro (KDE4_ADD_APP_ICON appsources pattern) ) # This will register the icon into the bundle - set(MACOSX_BUNDLE_ICON_FILE ${target}.icns) + set(MACOSX_BUNDLE_ICON_FILE ${appsources}.icns) # Append the icns file to the sources list so it will be a dependency to the # main target list(APPEND ${appsources} ${_outfilename}.icns) - # this doesn't seem to work for me - Use manual "install" instead - # TODO: test again with cmake 2.6 ? - # SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/${target}.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources) - - install(FILES ${_outfilename}.icns DESTINATION ${BIN_INSTALL_DIR}/${target}.app/Contents/Resources/) + # Install the icon into the Resources dir in the bundle + set_source_files_properties(${_outfilename}.icns PROPERTIES MACOSX_PACKAGE_LOCATION 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!") + message(STATUS "Unable to find an 128x128 icon that matches pattern ${pattern} for variable ${appsources} - 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!") endif(SIPS_EXECUTABLE AND TIFF2ICNS_EXECUTABLE) - endif(Q_WS_MAC) + endif(Q_WS_MAC) endmacro (KDE4_ADD_APP_ICON) |