summaryrefslogtreecommitdiff
path: root/cmake/FindConvert.cmake
blob: 8f53670028a14704d380d39166c1b76a6ee66c2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Copyright (C) 2013 Christian Dywan
# Copyright (C) 2013 Olivier Duchateau

find_program (RSVG_CONVERT rsvg-convert)

if (RSVG_CONVERT)
    set (CONVERT_FOUND TRUE)
    macro (SVG2PNG filename install_destination)
        string(REPLACE "/" "_" target ${filename})
        file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${filename}")
        add_custom_target ("${target}.png" ALL
            ${RSVG_CONVERT} --keep-aspect-ratio --format=png "${CMAKE_CURRENT_SOURCE_DIR}/${filename}.svg"
                --output "${CMAKE_CURRENT_BINARY_DIR}/${filename}.png"
        )
        install (FILES "${CMAKE_CURRENT_BINARY_DIR}/${filename}.png"
            DESTINATION ${install_destination})
    endmacro (SVG2PNG filename)
endif ()