Warning, /education/gcompris/cmake/kdeFetchTranslation.cmake is written in an unsupported language. File is not indexed.

0001 #
0002 # This file is mostly copied from the KDECMakeSettings.cmake:
0003 # https://github.com/KDE/extra-cmake-modules/blob/master/kde-modules/KDECMakeSettings.cmake#L320
0004 # Once the last version of ECM will be available on most distributions, we'll
0005 # need to switch to it (or at least use it if available else switch to existing
0006 # l10n-fetch-po-files.py script to retrieve the po)
0007 #
0008 # License of KDECMakeSettings.cmake
0009 #=============================================================================
0010 # SPDX-FileCopyrightText: 2014 Alex Merry <alex.merry@kde.org>
0011 # SPDX-FileCopyrightText: 2013 Aleix Pol <aleixpol@kde.org>
0012 # SPDX-FileCopyrightText: 2012-2013 Stephen Kelly <steveire@gmail.com>
0013 # SPDX-FileCopyrightText: 2007 Matthias Kretz <kretz@kde.org>
0014 # SPDX-FileCopyrightText: 2006-2007 Laurent Montel <montel@kde.org>
0015 # SPDX-FileCopyrightText: 2006-2013 Alex Neundorf <neundorf@kde.org>
0016 #
0017 # SPDX-License-Identifier: BSD-3-Clause
0018 
0019 if(NOT TARGET fetch-translations AND KDE_L10N_AUTO_TRANSLATIONS)
0020     set(KDE_L10N_BRANCH "trunk" CACHE STRING "Branch from l10n.kde.org to fetch from: trunk | stable | lts | trunk_kde4 | stable_kde4")
0021 
0022     set(_reponame "gcompris")
0023 
0024     set(releaseme_clone_commands
0025         COMMAND git clone --depth 1 https://anongit.kde.org/releaseme.git
0026     )
0027     add_custom_command(
0028         OUTPUT "${CMAKE_BINARY_DIR}/releaseme"
0029         ${releaseme_clone_commands}
0030         COMMENT "Fetching releaseme scripts to download translations..."
0031     )
0032 
0033     set(_l10n_po_dir "${CMAKE_BINARY_DIR}/po")
0034     set(_l10n_poqm_dir "${CMAKE_BINARY_DIR}/poqm")
0035 
0036     if(CMAKE_VERSION VERSION_GREATER 3.2)
0037         set(extra BYPRODUCTS ${_l10n_po_dir} ${_l10n_poqm_dir})
0038     endif()
0039 
0040     set(fetch_commands
0041         COMMAND ruby "${CMAKE_BINARY_DIR}/releaseme/fetchpo.rb"
0042             --origin ${KDE_L10N_BRANCH}
0043             --project "${_reponame}"
0044             --output-dir "${_l10n_po_dir}"
0045             --output-poqm-dir "${_l10n_poqm_dir}"
0046             "${CMAKE_SOURCE_DIR}"
0047     )
0048 
0049     add_custom_target(fetch-translations ${_EXTRA_ARGS}
0050         COMMENT "Downloading translations for ${_reponame} branch ${KDE_L10N_BRANCH}..."
0051         COMMAND git -C "${CMAKE_BINARY_DIR}/releaseme" pull
0052         COMMAND cmake -E remove_directory ${_l10n_po_dir}
0053         COMMAND cmake -E remove_directory ${_l10n_poqm_dir}
0054         ${fetch_commands}
0055         ${extra}
0056         ${move_translations}
0057         DEPENDS "${CMAKE_BINARY_DIR}/releaseme"
0058     )
0059 
0060   set(move_translations COMMAND
0061     bash ${CMAKE_SOURCE_DIR}/tools/move_translations.sh ${_l10n_poqm_dir} ${CMAKE_SOURCE_DIR}/po
0062     )
0063 
0064     if(NOT EXISTS ${_l10n_po_dir} OR NOT EXISTS ${_l10n_poqm_dir})
0065         execute_process(${releaseme_clone_commands})
0066         execute_process(${fetch_commands})
0067         execute_process(${move_translations})
0068     endif()
0069 endif()