summaryrefslogtreecommitdiff
path: root/CMake/FindInkscape.cmake
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2024-11-14 19:35:45 +0100
committerJörg Frings-Fürst <debian@jff-webhosting.net>2024-11-14 19:35:45 +0100
commitdf5520aa2dae5b3ce7abf8733dcdd152898af163 (patch)
tree00d3047bfb14f682bfb5a21010c731ed649bfed7 /CMake/FindInkscape.cmake
parentdf247efec654e512242e4f4f1b0212034f9e01fe (diff)
parentec3c0f6f6e7153fa797dc57a0e95779cbc63a23b (diff)
Merge branch 'release/debian/1_5.3.0GA-1'debian/1_5.3.0GA-1
Diffstat (limited to 'CMake/FindInkscape.cmake')
-rw-r--r--CMake/FindInkscape.cmake47
1 files changed, 47 insertions, 0 deletions
diff --git a/CMake/FindInkscape.cmake b/CMake/FindInkscape.cmake
new file mode 100644
index 0000000..0ed7034
--- /dev/null
+++ b/CMake/FindInkscape.cmake
@@ -0,0 +1,47 @@
+
+# Try to find the Inkscape command-line SVG rasterizer
+# Once done this will define
+#
+# Inkscape_FOUND
+# Inkscape_EXECUTABLE Where to find Inkscape
+# Inkscape_VERSION The Inkscape version number
+# Inkscape_EXPORT Option to specify the destination file
+# Inkscape_GUI Option to disable the GUI if needed
+#
+# Module is from https://github.com/arx/ArxLibertatis
+
+find_program(
+ Inkscape_EXECUTABLE
+ NAMES inkscape
+ HINTS "C:/Program Files/Inkscape/bin"
+ DOC "Inkscape command-line SVG rasterizer"
+)
+
+execute_process(COMMAND ${Inkscape_EXECUTABLE} "--version" OUTPUT_VARIABLE _Inkscape_VERSION ERROR_QUIET)
+STRING(REGEX MATCH "[1-9]\.[0-9\+\.[0-9]+" _Inkscape_VERSION ${_Inkscape_VERSION})
+
+set(Inkscape_VERSION ${_Inkscape_VERSION} CACHE STRING "Inkscape Version")
+
+execute_process(COMMAND ${Inkscape_EXECUTABLE} "--help" OUTPUT_VARIABLE _Inkscape_HELP ERROR_QUIET)
+
+if(_Inkscape_HELP MATCHES "--without-gui")
+ set(Inkscape_GUI "--without-gui" CACHE STRING "Inkscape option to disable the GUI if needed")
+endif()
+
+if(NOT DEFINED Inkscape_EXPORT)
+ foreach(option IN ITEMS "--export-filename=" "--export-file=" "--export-png=")
+ if(_Inkscape_HELP MATCHES "${option}")
+ set(Inkscape_EXPORT "${option}" CACHE STRING "Inkscape option to specify the export filename")
+ break()
+ endif()
+ endforeach()
+ if(NOT DEFINED Inkscape_EXPORT)
+ message(WARNING "Could not determine Inkscape export file option, assuming -o")
+ set(Inkscape_EXPORT "-o " CACHE STRING "Inkscape option to specify the export filename")
+ endif()
+endif()
+
+# handle the QUIETLY and REQUIRED arguments and set Inkscape_FOUND to TRUE if
+# all listed variables are TRUE
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Inkscape REQUIRED_VARS Inkscape_EXECUTABLE) \ No newline at end of file