Warning, /office/alkimia/cmake/modules/Macros.cmake is written in an unsupported language. File is not indexed.

0001 # SPDX-FileCopyrightText: 2020,2023 Ralf Habacker
0002 #
0003 # SPDX-License-Identifier: BSD-3-Clause
0004 
0005 macro(feature_note text state)
0006     if(${state})
0007         message(STATUS "${text} is supported")
0008     else()
0009         message(WARNING "${text} is not supported")
0010     endif()
0011 endmacro()
0012 
0013 macro(feature_notes a b c d)
0014     feature_note("Fetching pages with javascript" ${a})
0015     feature_note("Preview of fetched pages" ${b})
0016     feature_note("Multilingual preview of web pages" ${c})
0017     feature_note("Inspecting of web pages" ${c})
0018 endmacro()
0019 
0020 if(BUILD_QT4)
0021 # SPDX-FileCopyrightText: 2006 Alexander Neundorf <neundorf@kde.org>
0022 #
0023 # SPDX-License-Identifier: BSD-3-Clause
0024 
0025 set(_ki18n_build_pofiles_script ${CMAKE_CURRENT_LIST_DIR}/build-pofiles.cmake)
0026 set(_ki18n_build_tsfiles_script ${CMAKE_CURRENT_LIST_DIR}/build-tsfiles.cmake)
0027 set(_ki18n_pmap_compile_script ${CMAKE_CURRENT_LIST_DIR}/ts-pmap-compile.py)
0028 find_program(KI18N_PYTHON_EXECUTABLE python3)
0029 find_program(GETTEXT_MSGFMT_EXECUTABLE msgfmt)
0030 
0031 # KI18N_INSTALL(po) does the following:
0032 # - Compiles kfoo.po into kfoo.mo and installs it in
0033 #   ${LOCALE_INSTALL_DIR}/fr/LC_MESSAGES or share/locale/fr/LC_MESSAGES if
0034 #   ${LOCALE_INSTALL_DIR} is not set.
0035 # - Installs kfoo.js in ${LOCALE_INSTALL_DIR}/fr/LC_SCRIPTS/kfoo
0036 #
0037 # KI18N_INSTALL_TS_FILES() is deprecated, use KI18N_INSTALL()
0038 #
0039 function(KI18N_INSTALL podir)
0040     if (NOT LOCALE_INSTALL_DIR)
0041         set(LOCALE_INSTALL_DIR share/locale)
0042     endif()
0043 
0044     if(NOT KI18N_PYTHON_EXECUTABLE)
0045         message(FATAL_ERROR "KI18N_PYTHON_EXECUTABLE was not found")
0046     endif()
0047 
0048     if(NOT GETTEXT_MSGFMT_EXECUTABLE)
0049         message(FATAL_ERROR "GETTEXT_MSGFMT_EXECUTABLE was not found")
0050     endif()
0051 
0052     # First try to find the po directory in the source directory, where the release scripts copy them before making the tarballs
0053     get_filename_component(absolute_podir ${podir} ABSOLUTE)
0054 
0055     # we try to find the po directory in the binary directory, in case it was downloaded
0056     # using ECM
0057     if (NOT (EXISTS "${absolute_podir}" AND IS_DIRECTORY "${absolute_podir}"))
0058             get_filename_component(absolute_podir ${CMAKE_CURRENT_BINARY_DIR}/${podir} ABSOLUTE)
0059     endif()
0060 
0061     if (NOT (EXISTS "${absolute_podir}" AND IS_DIRECTORY "${absolute_podir}"))
0062         # Nothing to do if there's no podir and it would create an empty
0063         # LOCALE_INSTALL_DIR in that case.
0064         return()
0065     endif()
0066 
0067     get_filename_component(dirname ${LOCALE_INSTALL_DIR} NAME)
0068     get_filename_component(destname ${LOCALE_INSTALL_DIR} DIRECTORY)
0069     string(MD5 pathmd5 ${absolute_podir})
0070 
0071     add_custom_target(pofiles-${pathmd5} ALL
0072         COMMENT "Generating mo..."
0073         COMMAND ${CMAKE_COMMAND}
0074                 -DGETTEXT_MSGFMT_EXECUTABLE=${GETTEXT_MSGFMT_EXECUTABLE}
0075                 -DCOPY_TO=${CMAKE_CURRENT_BINARY_DIR}/${dirname}
0076                 -DPO_DIR=${absolute_podir}
0077                 -P ${_ki18n_build_pofiles_script}
0078     )
0079     add_custom_target(tsfiles-${pathmd5} ALL
0080         COMMENT "Generating ts..."
0081         COMMAND ${CMAKE_COMMAND}
0082                 -DPYTHON_EXECUTABLE=${KI18N_PYTHON_EXECUTABLE}
0083                 -D_ki18n_pmap_compile_script=${_ki18n_pmap_compile_script}
0084                 -DCOPY_TO=${CMAKE_CURRENT_BINARY_DIR}/${dirname}
0085                 -DPO_DIR=${absolute_podir}
0086                 -P ${_ki18n_build_tsfiles_script}
0087     )
0088     if (NOT TARGET pofiles)
0089         add_custom_target(pofiles)
0090     endif()
0091     if (NOT TARGET tsfiles)
0092         add_custom_target(tsfiles)
0093     endif()
0094     add_dependencies(pofiles pofiles-${pathmd5})
0095     add_dependencies(tsfiles tsfiles-${pathmd5})
0096 
0097     file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${dirname})
0098     install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${dirname} DESTINATION ${destname})
0099 endfunction()
0100 
0101 endif()