Fix cmake Inkscape auto generate of SVG on OS X giving an error popup, the binary
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Mon, 26 Aug 2013 14:13:04 +0000 (14:13 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Mon, 26 Aug 2013 14:13:04 +0000 (14:13 +0000)
that is found by find_program is a shim that doesn't take command line arguments.

build_files/cmake/macros.cmake

index 71706d87d5c4863f541ebfad31fdfea8e4737fe3..ace1ed912be77eae76dc54f6bba35b53111e0f07 100644 (file)
@@ -819,6 +819,15 @@ macro(svg_to_png
        mark_as_advanced(INKSCAPE_EXE)
 
        if(INKSCAPE_EXE)
+               if(APPLE)
+                       # in OS X app bundle, the binary is a shim that doesn't take any
+                       # command line arguments, replace it with the actual binary
+                       string(REPLACE "MacOS/Inkscape" "Resources/bin/inkscape" INKSCAPE_REAL_EXE ${INKSCAPE_EXE})
+                       if(EXISTS "${INKSCAPE_REAL_EXE}")
+                               set(INKSCAPE_EXE ${INKSCAPE_REAL_EXE})
+                       endif()
+               endif()
+
                add_custom_command(
                        OUTPUT  ${_file_to}
                        COMMAND ${INKSCAPE_EXE} ${_file_from} --export-dpi=${dpi}  --without-gui --export-png=${_file_to}
@@ -831,4 +840,4 @@ macro(svg_to_png
        unset(_file_from)
        unset(_file_to)
 
-endmacro()
\ No newline at end of file
+endmacro()