summaryrefslogtreecommitdiff
path: root/cmake/qtbug-35164-patcher.cmake
blob: 2dbb2c35d2b8289cf7ea33985e3cba32b4c0dda8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Build the qtbug-35164-patcher tool
MESSAGE(STATUS "qtbug-35164-patcher")
PROJECT(qtbug-35164-patcher)
FIND_PACKAGE(Qt5Core REQUIRED)
ADD_EXECUTABLE(qtbug-35164-patcher
    ${bibletime_SOURCE_DIR}/i18n/qtbug-35164-patcher.cpp
)
TARGET_LINK_LIBRARIES(qtbug-35164-patcher Qt5::Core)


# Run    qtbug-35164-patcher <file>.ts <file>.ts2,    then rename <file>.ts2 to <file>.ts
FUNCTION(qtbug_35164_patcher_func)
    MESSAGE(STATUS "Bug patcher")
    SET(TS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/i18n/messages")
    BT_GET_TS_LANGS(TS_LANGS)
    FOREACH(TS_LANG ${TS_LANGS})
        ADD_CUSTOM_TARGET("qtbug_35164_patcher_${TS_LANG}" 
            COMMAND ${CMAKE_CURRENT_BINARY_DIR}/qtbug-35164-patcher${CMAKE_EXECUTABLE_SUFFIX}
                ${TS_DIR}/bibletime_ui_${TS_LANG}.ts
                ${TS_DIR}/bibletime_ui_${TS_LANG}.ts2

            # Comment out the next 3 lines to be able to see both the unpatched and patched files.
            COMMAND ${CMAKE_COMMAND} -E rename
                ${TS_DIR}/bibletime_ui_${TS_LANG}.ts2
                ${TS_DIR}/bibletime_ui_${TS_LANG}.ts

            COMMENT "ran qtbug_35164_patcher on bibletime_ui_${TS_LANG}.ts"
        )
        # Ensure tool is built first and that the ts file is created first
        ADD_DEPENDENCIES("qtbug_35164_patcher_${TS_LANG}" "messages_${TS_LANG}" "qtbug-35164-patcher" )
        ADD_DEPENDENCIES("messages" "qtbug_35164_patcher_${TS_LANG}")
    ENDFOREACH()
endfunction()

qtbug_35164_patcher_func()