diff cmake/SvgToPng.cmake @ 0:49cd5cc0b072

Initial commit of project template (based on RetraceIT)
author Andre Heinecke <andre.heinecke@intevation.de>
date Mon, 07 Mar 2016 17:35:09 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmake/SvgToPng.cmake	Mon Mar 07 17:35:09 2016 +0100
@@ -0,0 +1,29 @@
+macro(svg_to_png
+      file_from
+      file_to
+      dpi
+      size
+      list_to_add)
+
+# remove ../'s
+get_filename_component(_file_from ${CMAKE_CURRENT_SOURCE_DIR}/${file_from} REALPATH)
+get_filename_component(_file_to   ${CMAKE_CURRENT_SOURCE_DIR}/${file_to}   REALPATH)
+
+list(APPEND ${list_to_add} ${_file_to})
+
+find_program(INKSCAPE_EXE inkscape)
+mark_as_advanced(INKSCAPE_EXE)
+
+if(INKSCAPE_EXE)
+   add_custom_command(
+      OUTPUT  ${_file_to}
+      COMMAND ${INKSCAPE_EXE} ${_file_from} --export-width=${size} --export-height=${size} --export-dpi=${dpi}  --without-gui --export-png=${_file_to}
+      DEPENDS ${_file_from} ${INKSCAPE_EXE}
+   )
+else()
+   message(WARNING "Inkscape not found, could not re-generate ${_file_to} from ${_file_from}!")
+endif()
+
+unset(_file_from)
+unset(_file_to)
+endmacro()
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)