summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt2
-rw-r--r--CMakeScripts/DefineDependsandFlags.cmake11
-rw-r--r--CMakeScripts/Modules/FindGettext.cmake237
-rw-r--r--po/CMakeLists.txt45
4 files changed, 32 insertions, 263 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6ed211420..5a9c31fc2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 2.8.2)
+cmake_minimum_required(VERSION 2.8.8)
cmake_policy(SET CMP0003 NEW) # don't be prolific with library paths
cmake_policy(SET CMP0005 NEW) # proper define quoting
diff --git a/CMakeScripts/DefineDependsandFlags.cmake b/CMakeScripts/DefineDependsandFlags.cmake
index f3663c353..0655935db 100644
--- a/CMakeScripts/DefineDependsandFlags.cmake
+++ b/CMakeScripts/DefineDependsandFlags.cmake
@@ -259,14 +259,14 @@ list(GET GTKMM_VERSION_COMPONENTS 2 INKSCAPE_GTKMM_MICRO_VERSION)
pkg_check_modules(GDL_3_6 gdl-3.0>=3.6)
if("${GDL_3_6_FOUND}")
- message("Using GDL 3.6 or higher")
+ message(STATUS "Using GDL 3.6 or higher")
add_definitions(-DWITH_GDL_3_6)
set (WITH_GDL_3_6 ON)
endif()
pkg_check_modules(GTKSPELL3 gtkspell3-3.0)
if("${GTKSPELL3_FOUND}")
- message("Using GtkSpell 3")
+ message(STATUS "Using GtkSpell 3")
list(APPEND INKSCAPE_INCS_SYS ${GTKSPELL3_INCLUDE_DIRS})
list(APPEND INKSCAPE_LIBS ${GTKSPELL3_LIBRARIES})
set(WITH_GTKSPELL ON)
@@ -346,6 +346,13 @@ if(WITH_NLS)
else(GETTEXT_FOUND)
message(STATUS "Cannot find gettext + msgfmt to convert language file. Translation won't be enabled")
endif(GETTEXT_FOUND)
+
+ find_program(INTLTOOL-UPDATE intltool-update)
+ if(INTLTOOL-UPDATE)
+ message(STATUS "Found íntltool. inkscape.pot will be re-created if missing.")
+ else()
+ message(STATUS "Did not find íntltool. inkscape.pot can't be re-created.")
+ endif()
endif(WITH_NLS)
pkg_check_modules(SIGC++ REQUIRED sigc++-2.0 )
diff --git a/CMakeScripts/Modules/FindGettext.cmake b/CMakeScripts/Modules/FindGettext.cmake
deleted file mode 100644
index 753040b40..000000000
--- a/CMakeScripts/Modules/FindGettext.cmake
+++ /dev/null
@@ -1,237 +0,0 @@
-#.rst:
-# FindGettext
-# -----------
-#
-# Find GNU gettext tools
-#
-# This module looks for the GNU gettext tools. This module defines the
-# following values:
-#
-# ::
-#
-# GETTEXT_MSGMERGE_EXECUTABLE: the full path to the msgmerge tool.
-# GETTEXT_MSGFMT_EXECUTABLE: the full path to the msgfmt tool.
-# GETTEXT_FOUND: True if gettext has been found.
-# GETTEXT_VERSION_STRING: the version of gettext found (since CMake 2.8.8)
-#
-#
-#
-# Additionally it provides the following macros:
-# GETTEXT_CREATE_TRANSLATIONS ( outputFile [ALL] file1 ... fileN )
-#
-# ::
-#
-# This will create a target "translations" which will convert the
-# given input po files into the binary output mo file. If the
-# ALL option is used, the translations will also be created when
-# building the default target.
-#
-# GETTEXT_PROCESS_POT( <potfile> [ALL] [INSTALL_DESTINATION <destdir>]
-# LANGUAGES <lang1> <lang2> ... )
-#
-# ::
-#
-# Process the given pot file to mo files.
-# If INSTALL_DESTINATION is given then automatically install rules will be created,
-# the language subdirectory will be taken into account (by default use share/locale/).
-# If ALL is specified, the pot file is processed when building the all traget.
-# It creates a custom target "potfile".
-#
-# GETTEXT_PROCESS_PO_FILES( <lang> [ALL] [INSTALL_DESTINATION <dir>]
-# PO_FILES <po1> <po2> ... )
-#
-# ::
-#
-# Process the given po files to mo files for the given language.
-# If INSTALL_DESTINATION is given then automatically install rules will be created,
-# the language subdirectory will be taken into account (by default use share/locale/).
-# If ALL is specified, the po files are processed when building the all traget.
-# It creates a custom target "pofiles".
-
-#=============================================================================
-# Copyright 2007-2009 Kitware, Inc.
-# Copyright 2007 Alexander Neundorf <neundorf@kde.org>
-#
-# Distributed under the OSI-approved BSD License (the "License");
-# see accompanying file Copyright.txt for details.
-#
-# This software is distributed WITHOUT ANY WARRANTY; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the License for more information.
-#=============================================================================
-# (To distribute this file outside of CMake, substitute the full
-# License text for the above reference.)
-#=============================================================================
-# This file got changed for Inkscape's purposes to name the .mo files installed with
-# GETTEXT_PROCESS_PO_FILES ${CMAKE_PROJECT_NAME}.mo instead of <language>.mo
-
-find_program(GETTEXT_MSGMERGE_EXECUTABLE msgmerge)
-
-find_program(GETTEXT_MSGFMT_EXECUTABLE msgfmt)
-
-if(GETTEXT_MSGMERGE_EXECUTABLE)
- execute_process(COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --version
- OUTPUT_VARIABLE gettext_version
- ERROR_QUIET
- OUTPUT_STRIP_TRAILING_WHITESPACE)
- if (gettext_version MATCHES "^msgmerge \\(.*\\) [0-9]")
- string(REGEX REPLACE "^msgmerge \\([^\\)]*\\) ([0-9\\.]+[^ \n]*).*" "\\1" GETTEXT_VERSION_STRING "${gettext_version}")
- endif()
- unset(gettext_version)
-endif()
-
-include(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Gettext
- REQUIRED_VARS GETTEXT_MSGMERGE_EXECUTABLE GETTEXT_MSGFMT_EXECUTABLE
- VERSION_VAR GETTEXT_VERSION_STRING)
-
-include(CMakeParseArguments)
-
-function(_GETTEXT_GET_UNIQUE_TARGET_NAME _name _unique_name)
- set(propertyName "_GETTEXT_UNIQUE_COUNTER_${_name}")
- get_property(currentCounter GLOBAL PROPERTY "${propertyName}")
- if(NOT currentCounter)
- set(currentCounter 1)
- endif()
- set(${_unique_name} "${_name}_${currentCounter}" PARENT_SCOPE)
- math(EXPR currentCounter "${currentCounter} + 1")
- set_property(GLOBAL PROPERTY ${propertyName} ${currentCounter} )
-endfunction()
-
-macro(GETTEXT_CREATE_TRANSLATIONS _potFile _firstPoFileArg)
- # make it a real variable, so we can modify it here
- set(_firstPoFile "${_firstPoFileArg}")
-
- set(_gmoFiles)
- get_filename_component(_potName ${_potFile} NAME)
- string(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" _potBasename ${_potName})
- get_filename_component(_absPotFile ${_potFile} ABSOLUTE)
-
- set(_addToAll)
- if(${_firstPoFile} STREQUAL "ALL")
- set(_addToAll "ALL")
- set(_firstPoFile)
- endif()
-
- foreach (_currentPoFile ${_firstPoFile} ${ARGN})
- get_filename_component(_absFile ${_currentPoFile} ABSOLUTE)
- get_filename_component(_abs_PATH ${_absFile} PATH)
- get_filename_component(_lang ${_absFile} NAME_WE)
- set(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo)
-
- add_custom_command(
- OUTPUT ${_gmoFile}
- COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${_absFile} ${_absPotFile}
- COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_absFile}
- DEPENDS ${_absPotFile} ${_absFile}
- )
-
- install(FILES ${_gmoFile} DESTINATION share/locale/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo)
- set(_gmoFiles ${_gmoFiles} ${_gmoFile})
-
- endforeach ()
-
- if(NOT TARGET translations)
- add_custom_target(translations)
- endif()
-
- _GETTEXT_GET_UNIQUE_TARGET_NAME(translations uniqueTargetName)
-
- add_custom_target(${uniqueTargetName} ${_addToAll} DEPENDS ${_gmoFiles})
-
- add_dependencies(translations ${uniqueTargetName})
-
-endmacro()
-
-
-function(GETTEXT_PROCESS_POT_FILE _potFile)
- set(_gmoFiles)
- set(_options ALL)
- set(_oneValueArgs INSTALL_DESTINATION)
- set(_multiValueArgs LANGUAGES)
-
- CMAKE_PARSE_ARGUMENTS(_parsedArguments "${_options}" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN})
-
- get_filename_component(_potName ${_potFile} NAME)
- string(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" _potBasename ${_potName})
- get_filename_component(_absPotFile ${_potFile} ABSOLUTE)
-
- foreach (_lang ${_parsedArguments_LANGUAGES})
- set(_poFile "${CMAKE_CURRENT_BINARY_DIR}/${_lang}.po")
- set(_gmoFile "${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo")
-
- add_custom_command(
- OUTPUT "${_poFile}"
- COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${_poFile} ${_absPotFile}
- DEPENDS ${_absPotFile}
- )
-
- add_custom_command(
- OUTPUT "${_gmoFile}"
- COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_poFile}
- DEPENDS ${_absPotFile} ${_poFile}
- )
-
- if(_parsedArguments_INSTALL_DESTINATION)
- install(FILES ${_gmoFile} DESTINATION ${_parsedArguments_INSTALL_DESTINATION}/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo)
- endif()
- list(APPEND _gmoFiles ${_gmoFile})
- endforeach ()
-
- if(NOT TARGET potfiles)
- add_custom_target(potfiles)
- endif()
-
- _GETTEXT_GET_UNIQUE_TARGET_NAME( potfiles uniqueTargetName)
-
- if(_parsedArguments_ALL)
- add_custom_target(${uniqueTargetName} ALL DEPENDS ${_gmoFiles})
- else()
- add_custom_target(${uniqueTargetName} DEPENDS ${_gmoFiles})
- endif()
-
- add_dependencies(potfiles ${uniqueTargetName})
-
-endfunction()
-
-
-function(GETTEXT_PROCESS_PO_FILES _lang)
- set(_options ALL)
- set(_oneValueArgs INSTALL_DESTINATION)
- set(_multiValueArgs PO_FILES)
- set(_gmoFiles)
-
- CMAKE_PARSE_ARGUMENTS(_parsedArguments "${_options}" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN})
-
- foreach(_current_PO_FILE ${_parsedArguments_PO_FILES})
- get_filename_component(_name ${_current_PO_FILE} NAME)
- string(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" _basename ${_name})
- set(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.gmo)
- add_custom_command(OUTPUT ${_gmoFile}
- COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_current_PO_FILE}
- WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
- DEPENDS ${_current_PO_FILE}
- )
-
- if(_parsedArguments_INSTALL_DESTINATION)
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.gmo DESTINATION ${_parsedArguments_INSTALL_DESTINATION}/${_lang}/LC_MESSAGES/ RENAME ${CMAKE_PROJECT_NAME}.mo)
- endif()
- list(APPEND _gmoFiles ${_gmoFile})
- endforeach()
-
-
- if(NOT TARGET pofiles)
- add_custom_target(pofiles)
- endif()
-
- _GETTEXT_GET_UNIQUE_TARGET_NAME( pofiles uniqueTargetName)
-
- if(_parsedArguments_ALL)
- add_custom_target(${uniqueTargetName} ALL DEPENDS ${_gmoFiles})
- else()
- add_custom_target(${uniqueTargetName} DEPENDS ${_gmoFiles})
- endif()
-
- add_dependencies(pofiles ${uniqueTargetName})
-
-endfunction()
diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt
index ce9a03ca2..94625e4da 100644
--- a/po/CMakeLists.txt
+++ b/po/CMakeLists.txt
@@ -1,18 +1,16 @@
+# process and install .po files
file(GLOB LANGUAGES *.po)
foreach(language ${LANGUAGES})
- string(REGEX REPLACE "(.+(\\\\|/))+" "" language ${language})
- string(REGEX REPLACE "\\.po$" "" language ${language})
- set(pofile ${CMAKE_CURRENT_SOURCE_DIR}/${language}.po)
- GETTEXT_PROCESS_PO_FILES(${language} ALL INSTALL_DESTINATION "share/locale/" PO_FILES ${pofile})
+ string(REGEX REPLACE "(.+(\\\\|/))+" "" language ${language})
+ string(REGEX REPLACE "\\.po$" "" language ${language})
+ set(pofile ${CMAKE_CURRENT_SOURCE_DIR}/${language}.po)
+ GETTEXT_PROCESS_PO_FILES(${language} ALL INSTALL_DESTINATION "share/locale/" PO_FILES ${pofile})
endforeach(language)
-if(NOT WIN32)
-#translates inkscape.desktop
-add_custom_target(inkscape_desktop DEPENDS ${CMAKE_BINARY_DIR}/inkscape.desktop)
-
-if(${GETTEXT_VERSION_STRING} VERSION_GREATER "0.19")
- add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/inkscape.desktop
+# translate inkscape.desktop
+if("${GETTEXT_VERSION_STRING}" VERSION_GREATER "0.19")
+ add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/inkscape.desktop
DEPENDS ${LANGUAGES}
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} --desktop --template ${CMAKE_SOURCE_DIR}/inkscape.desktop.template -d ${CMAKE_CURRENT_SOURCE_DIR} -o ${CMAKE_BINARY_DIR}/inkscape.desktop.template.in --keyword=Name --keyword=GenericName --keyword=X-GNOME-FullName --keyword=Comment --keyword=Keywords
COMMAND ${CMAKE_COMMAND} -DINKSCAPE_SOURCE_DIR=${CMAKE_SOURCE_DIR} -DINKSCAPE_BINARY_DIR=${CMAKE_BINARY_DIR} -DENABLE_BINRELOC=${ENABLE_BINRELOC} -P ${CMAKE_SOURCE_DIR}/CMakeScripts/inkscape-desktop.cmake
@@ -24,20 +22,21 @@ else()
COMMAND ${CMAKE_COMMAND} -DINKSCAPE_SOURCE_DIR=${CMAKE_SOURCE_DIR} -DINKSCAPE_BINARY_DIR=${CMAKE_BINARY_DIR} -DENABLE_BINRELOC=${ENABLE_BINRELOC} -P ${CMAKE_SOURCE_DIR}/CMakeScripts/inkscape-desktop.cmake
)
endif()
+add_custom_target(inkscape_desktop ALL DEPENDS ${CMAKE_BINARY_DIR}/inkscape.desktop)
-add_dependencies(inkscape inkscape_desktop)
-add_custom_command(
- OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/inkscape.pot
- COMMAND intltool-update --pot && mv untitled.pot ${CMAKE_CURRENT_SOURCE_DIR}/inkscape.pot
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- )
-set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/inkscape.pot PROPERTIES GENERATED TRUE)
-add_custom_target(inkscape_pot ALL DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/inkscape.pot)
-add_dependencies(inkscape_pot filters_svg_h)
-add_dependencies(inkscape_pot palettes_h)
-add_dependencies(inkscape_pot patterns_svg_h)
-add_dependencies(inkscape_pot symbols_h)
-add_dependencies(inkscape_pot templates_h)
+# update inkscape.pot
+if(INTLTOOL-UPDATE)
+ add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/inkscape.pot
+ COMMAND sh -c "${INTLTOOL-UPDATE} --pot && mv untitled.pot ${CMAKE_CURRENT_SOURCE_DIR}/inkscape.pot"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ )
+ set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/inkscape.pot PROPERTIES GENERATED TRUE)
+ add_custom_target(inkscape_pot ALL DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/inkscape.pot)
+ add_dependencies(inkscape_pot filters_svg_h)
+ add_dependencies(inkscape_pot palettes_h)
+ add_dependencies(inkscape_pot patterns_svg_h)
+ add_dependencies(inkscape_pot symbols_h)
+ add_dependencies(inkscape_pot templates_h)
endif()