~midori/midori/trunk

6350.2.1 by Christian Dywan
Initial minimal CMake build setup
1
# Copyright (C) 2013 Christian Dywan <christian@twotoasts.de>
2
6395.3.4 by Christian Dywan
Move convert macro into its own file and use it for icons
3
include(FindConvert)
4
if (NOT CONVERT_FOUND)
6395.3.2 by Christian Dywan
Fail if rsvg-convert couldn't be found
5
    message(FATAL_ERROR "rsvg-convert not found")
6395.3.1 by Olivier Duchateau
Add cmake macro to rasterize SVG to PNG
6
endif ()
7
6350.2.13 by Christian Dywan
Merge translations into .desktop files
8
include(FindIntltool)
9
if (NOT INTLTOOL_MERGE_FOUND)
10
    message(FATAL_ERROR "intltool-merge not found")
6350.2.14 by Christian Dywan
Add pot target to update translation template
11
elseif (NOT INTLTOOL_UPDATE_FOUND)
12
    message(FATAL_ERROR "intltool-update not found")
6350.2.13 by Christian Dywan
Merge translations into .desktop files
13
endif ()
14
6350.2.12 by Paweł Forysiuk
Install data files with CMake
15
file(GLOB_RECURSE DATA_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *)
16
list(REMOVE_ITEM DATA_FILES "CMakeLists.txt")
17
18
foreach(FILE ${DATA_FILES})
6441.1.1 by Christian Dywan
Re-arrange data file installing to be more explicit
19
    if (${FILE} MATCHES "faq.")
6376.3.1 by Christian Dywan
Install FAQ html and css to doc dir
20
        install(FILES ${FILE} DESTINATION ${CMAKE_INSTALL_DOCDIR})
6441.1.1 by Christian Dywan
Re-arrange data file installing to be more explicit
21
    elseif (${FILE} MATCHES ".desktop")
22
        if (NOT WIN32)
23
            string(REPLACE ".desktop.in" "" DESKTOP_ID ${FILE})
24
            INTLTOOL_MERGE_DESKTOP (${DESKTOP_ID} po)
25
        endif ()
26
    elseif (${FILE} MATCHES ".appdata.xml")
27
        if (NOT WIN32)
28
            string(REPLACE ".appdata.xml.in" "" DESKTOP_ID ${FILE})
29
            INTLTOOL_MERGE_APPDATA (${DESKTOP_ID} po)
30
        endif ()
6504.1.2 by Paweł Forysiuk
Tweak matching of other extensions as well
31
    elseif (${FILE} MATCHES "\\.svg$")
6441.1.1 by Christian Dywan
Re-arrange data file installing to be more explicit
32
        string(REPLACE ".svg" "" IMG_ID ${FILE})
6604.2.4 by Paweł Forysiuk
Properly install generated png files in adblock subfolder
33
        string (FIND ${FILE} "/" IS_DIR)
34
        if (IS_DIR GREATER -1)
35
            string(REPLACE "/" ";" DIR_LIST ${FILE})
36
            LIST(GET DIR_LIST 0 S_DIR)
37
            SVG2PNG (${IMG_ID} "${CMAKE_INSTALL_DATADIR}/midori/res/${S_DIR}")
38
        else ()
39
            SVG2PNG (${IMG_ID} "${CMAKE_INSTALL_DATADIR}/midori/res/")
40
        endif()
6441.1.1 by Christian Dywan
Re-arrange data file installing to be more explicit
41
    # These are being handled in add_executable for the "midori" binary
6504.1.2 by Paweł Forysiuk
Tweak matching of other extensions as well
42
    elseif (${FILE} MATCHES "\\.ico$")
43
    elseif (${FILE} MATCHES "\\.rc$")
6441.1.2 by Christian Dywan
Add comment clarifying why .swf is ignored
44
    # This is only meant for testing, and not used in production
6504.1.2 by Paweł Forysiuk
Tweak matching of other extensions as well
45
    elseif (${FILE} MATCHES "\\.swf$")
6350.2.12 by Paweł Forysiuk
Install data files with CMake
46
    else()
47
        string(FIND ${FILE} "/" IS_DIR)
48
        if (IS_DIR GREATER -1)
49
            string(REPLACE "/" ";" DIR_LIST ${FILE})
50
            LIST(GET DIR_LIST 0 S_DIR)
51
            LIST(GET DIR_LIST 1 S_FILE)
52
            install(FILES ${S_DIR}/${S_FILE} DESTINATION ${CMAKE_INSTALL_DATADIR}/midori/res/${S_DIR})
53
        else ()
54
            install(FILES ${FILE} DESTINATION ${CMAKE_INSTALL_DATADIR}/midori/res/)
55
        endif()
56
    endif()
57
58
endforeach()