annotate cmake/SvgToPng.cmake @ 20:6b5e7d6bf4a2 0.0.1

Emit warning when a picture can not be loaded
author Andre Heinecke <andre.heinecke@intevation.de>
date Tue, 14 Apr 2015 18:56:54 +0200
parents 147b08bc7d64
children
rev   line source
0
147b08bc7d64 Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
1 macro(svg_to_png
147b08bc7d64 Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
2 file_from
147b08bc7d64 Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
3 file_to
147b08bc7d64 Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
4 dpi
147b08bc7d64 Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
5 size
147b08bc7d64 Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
6 list_to_add)
147b08bc7d64 Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
7
147b08bc7d64 Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
8 # remove ../'s
147b08bc7d64 Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
9 get_filename_component(_file_from ${CMAKE_CURRENT_SOURCE_DIR}/${file_from} REALPATH)
147b08bc7d64 Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
10 get_filename_component(_file_to ${CMAKE_CURRENT_SOURCE_DIR}/${file_to} REALPATH)
147b08bc7d64 Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
11
147b08bc7d64 Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
12 list(APPEND ${list_to_add} ${_file_to})
147b08bc7d64 Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
13
147b08bc7d64 Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
14 find_program(INKSCAPE_EXE inkscape)
147b08bc7d64 Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
15 mark_as_advanced(INKSCAPE_EXE)
147b08bc7d64 Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
16
147b08bc7d64 Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
17 if(INKSCAPE_EXE)
147b08bc7d64 Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
18 add_custom_command(
147b08bc7d64 Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
19 OUTPUT ${_file_to}
147b08bc7d64 Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
20 COMMAND ${INKSCAPE_EXE} ${_file_from} --export-width=${size} --export-height=${size} --export-dpi=${dpi} --without-gui --export-png=${_file_to}
147b08bc7d64 Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
21 DEPENDS ${_file_from} ${INKSCAPE_EXE}
147b08bc7d64 Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
22 )
147b08bc7d64 Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
23 else()
147b08bc7d64 Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
24 message(WARNING "Inkscape not found, could not re-generate ${_file_to} from ${_file_from}!")
147b08bc7d64 Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
25 endif()
147b08bc7d64 Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
26
147b08bc7d64 Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
27 unset(_file_from)
147b08bc7d64 Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
28 unset(_file_to)
147b08bc7d64 Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
29 endmacro()
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)