diff options
author | Dominik Schmidt <kde@dominik-schmidt.de> | 2018-06-23 15:26:35 +0200 |
---|---|---|
committer | Dominik Schmidt <kde@dominik-schmidt.de> | 2018-07-08 20:00:34 +0200 |
commit | 2c2bb8f4766fec5e391839dbc093b638acee3a22 (patch) | |
tree | 6e9f761f5aa2a5ae5ddca834b4c17e8d7e5f9dd9 /find-modules/FindIcoTool.cmake | |
parent | d6cc583f32a4ca0f05ccad8e30cf84b74e9e9561 (diff) | |
download | extra-cmake-modules-2c2bb8f4766fec5e391839dbc093b638acee3a22.tar.gz extra-cmake-modules-2c2bb8f4766fec5e391839dbc093b638acee3a22.tar.bz2 |
Improve ECMAddAppIconMacro.
Summary:
- Add support for SIDEBAR_ICONS on macOS
- Allow specifying a basename for the icon file via OUTFILE_BASENAME
- Add support for HiRes icons on Windows via icotool
I'm sorry this went all into one big change. I see that it's not optimal,
but it's really hard to rip it apart...
Also to me the whole code with support for two flavors of png2ico and icotool seems very spaghetti-ish. IMHO there's no good reason to keep supporting all three, icotool is the only maintained project and the only one supporting more than 128px wide icons. That's why I would suggest to simplify the whole code by only supporting icotool in one of the next releases.
Test Plan:
We use this version of ECMAddAppIconMacro in ownCloud client and it works...
I tested icotool natively and while cross-compiling on linux.
SIDEBAR_ICONS are also working...
If you want to test this with the ownCloud client, it's best to use
https://github.com/dschmidt/owncloud-client/tree/fix-app-icon-macro
because that contains a small fix I just PR'ed and which is not
in master yet. (We maintain a fork of the module there, so compiling it for Windows or macOS will automatically use the version of the module that I'm submitting)
Reviewers: vonreth, vpinon, apol, alexmerry, cgiboudeaux
Reviewed By: cgiboudeaux
Subscribers: cgiboudeaux, kde-frameworks-devel, kde-buildsystem
Tags: #frameworks, #build_system
Differential Revision: https://phabricator.kde.org/D13698
Diffstat (limited to 'find-modules/FindIcoTool.cmake')
-rw-r--r-- | find-modules/FindIcoTool.cmake | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/find-modules/FindIcoTool.cmake b/find-modules/FindIcoTool.cmake new file mode 100644 index 00000000..cf893d62 --- /dev/null +++ b/find-modules/FindIcoTool.cmake @@ -0,0 +1,80 @@ +#.rst: +# FindIcoTool +# ----------- +# +# Try to find icotool. +# +# If the icotool executable is not in your PATH, you can provide +# an alternative name or full path location with the ``IcoTool_EXECUTABLE`` +# variable. +# +# This will define the following variables: +# +# ``IcoTool_FOUND`` +# True if icotool is available. +# +# ``IcoTool_EXECUTABLE`` +# The icotool executable. +# +# If ``IcoTool_FOUND`` is TRUE, it will also define the following imported +# target: +# +# ``IcoTool::IcoTool`` +# The icotool executable. +# +# Since 5.48. + +#============================================================================= +# Copyright 2017 Vincent Pinon <vpinon@kde.org> +# Copyright 2014 Alex Merry <alex.merry@kde.org> +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +include(${CMAKE_CURRENT_LIST_DIR}/ECMFindModuleHelpersStub.cmake) +ecm_find_package_version_check(IcoTool) +find_program(IcoTool_EXECUTABLE NAMES icotool) +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(IcoTool + FOUND_VAR + IcoTool_FOUND + REQUIRED_VARS + IcoTool_EXECUTABLE +) +mark_as_advanced(IcoTool_EXECUTABLE) + +if (IcoTool_FOUND) + if (NOT TARGET IcoTool::IcoTool) + add_executable(IcoTool::IcoTool IMPORTED) + set_target_properties(IcoTool::IcoTool PROPERTIES + IMPORTED_LOCATION "${IcoTool_EXECUTABLE}" + ) + endif() +endif() + +include(FeatureSummary) +set_package_properties(IcoTool PROPERTIES + URL "http://www.nongnu.org/icoutils/" + DESCRIPTION "Executable that converts a collection of PNG files into a Windows icon file" +) |