From 5d1bc1e7ad9fdfac1d044616a5c5c072fb86a3ee Mon Sep 17 00:00:00 2001 From: houz Date: Wed, 2 Sep 2015 15:40:51 +0200 Subject: remove unneccessary include from r14304 (bzr r14340) --- CMakeScripts/Modules/FindGettext.cmake | 237 +++++++++++++++++++++++++++++++++ 1 file changed, 237 insertions(+) create mode 100644 CMakeScripts/Modules/FindGettext.cmake (limited to 'CMakeScripts/Modules') diff --git a/CMakeScripts/Modules/FindGettext.cmake b/CMakeScripts/Modules/FindGettext.cmake new file mode 100644 index 000000000..753040b40 --- /dev/null +++ b/CMakeScripts/Modules/FindGettext.cmake @@ -0,0 +1,237 @@ +#.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( [ALL] [INSTALL_DESTINATION ] +# LANGUAGES ... ) +# +# :: +# +# 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( [ALL] [INSTALL_DESTINATION ] +# PO_FILES ... ) +# +# :: +# +# 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 +# +# 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 .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() -- cgit v1.2.3 From 6484d2580d5facccf1b4bd7719c5d26fb8d07602 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Mon, 9 Nov 2015 00:03:27 +0000 Subject: Add CMake check for Potrace from OSP: http://goo.gl/AEzbkQ Fixed bugs: - https://launchpad.net/bugs/1156664 (bzr r14449.1.3) --- CMakeScripts/Modules/FindPotrace.cmake | 36 ++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 CMakeScripts/Modules/FindPotrace.cmake (limited to 'CMakeScripts/Modules') diff --git a/CMakeScripts/Modules/FindPotrace.cmake b/CMakeScripts/Modules/FindPotrace.cmake new file mode 100644 index 000000000..a542394fe --- /dev/null +++ b/CMakeScripts/Modules/FindPotrace.cmake @@ -0,0 +1,36 @@ +# POTRACE_FOUND - system has Potrace +# POTRACE_INCLUDE_DIR - the Potrace include directory +# POTRACE_LIBRARIES - The libraries needed to use Potrace + +FIND_PATH(POTRACE_INCLUDE_DIR potracelib.h + /usr/include + /usr/local/include +) + +FIND_LIBRARY(POTRACE_LIBRARY NAMES potrace libpotrace + PATHS + /usr/lib + /usr/local/lib +) + +if (POTRACE_INCLUDE_DIR AND POTRACE_LIBRARY) + set(POTRACE_FOUND TRUE) + set(POTRACE_LIBRARIES ${POTRACE_LIBRARY}) +else (POTRACE_INCLUDE_DIR AND POTRACE_LIBRARY) + set(POTRACE_FOUND FALSE) +endif (POTRACE_INCLUDE_DIR AND POTRACE_LIBRARY) + +if (POTRACE_FOUND) + if (NOT Potrace_FIND_QUIETLY) + message(STATUS "Found potrace: ${POTRACE_LIBRARIES}") + endif (NOT Potrace_FIND_QUIETLY) +else (POTRACE_FOUND) + if (NOT Potrace_FIND_QUIETLY) + + message(STATUS "don't find potrace") + + endif (NOT Potrace_FIND_QUIETLY) +endif (POTRACE_FOUND) + +MARK_AS_ADVANCED(POTRACE_INCLUDE_DIR POTRACE_LIBRARIES POTRACE_LIBRARY) + -- cgit v1.2.3 From ac1a99494b6afaf5673f260f0e75559eff3b5ff5 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Thu, 12 Nov 2015 22:35:18 +0000 Subject: Update cmake Potrace module to match style of others (bzr r14449.1.5) --- CMakeScripts/Modules/FindPotrace.cmake | 92 ++++++++++++++++++++++------------ 1 file changed, 59 insertions(+), 33 deletions(-) (limited to 'CMakeScripts/Modules') diff --git a/CMakeScripts/Modules/FindPotrace.cmake b/CMakeScripts/Modules/FindPotrace.cmake index a542394fe..9ab995278 100644 --- a/CMakeScripts/Modules/FindPotrace.cmake +++ b/CMakeScripts/Modules/FindPotrace.cmake @@ -1,36 +1,62 @@ # POTRACE_FOUND - system has Potrace -# POTRACE_INCLUDE_DIR - the Potrace include directory +# POTRACE_INCLUDE_DIRS - the Potrace include directory # POTRACE_LIBRARIES - The libraries needed to use Potrace -FIND_PATH(POTRACE_INCLUDE_DIR potracelib.h - /usr/include - /usr/local/include -) - -FIND_LIBRARY(POTRACE_LIBRARY NAMES potrace libpotrace - PATHS - /usr/lib - /usr/local/lib -) - -if (POTRACE_INCLUDE_DIR AND POTRACE_LIBRARY) - set(POTRACE_FOUND TRUE) - set(POTRACE_LIBRARIES ${POTRACE_LIBRARY}) -else (POTRACE_INCLUDE_DIR AND POTRACE_LIBRARY) - set(POTRACE_FOUND FALSE) -endif (POTRACE_INCLUDE_DIR AND POTRACE_LIBRARY) - -if (POTRACE_FOUND) - if (NOT Potrace_FIND_QUIETLY) - message(STATUS "Found potrace: ${POTRACE_LIBRARIES}") - endif (NOT Potrace_FIND_QUIETLY) -else (POTRACE_FOUND) - if (NOT Potrace_FIND_QUIETLY) - - message(STATUS "don't find potrace") - - endif (NOT Potrace_FIND_QUIETLY) -endif (POTRACE_FOUND) - -MARK_AS_ADVANCED(POTRACE_INCLUDE_DIR POTRACE_LIBRARIES POTRACE_LIBRARY) - +IF (POTRACE_LIBRARIES AND POTRACE_INCLUDE_DIRS) + # in cache already + SET(POTRACE_FOUND TRUE) +ELSE (POTRACE_LIBRARIES AND POTRACE_INCLUDE_DIRS) + FIND_PATH (POTRACE_INCLUDE_DIR + NAMES + potracelib.h + PATHS + /usr/include + /usr/local/include + $ENV{DEVLIBS_PATH}/include + PATH_SUFFIXES + potrace + ) + + FIND_LIBRARY (POTRACE_LIBRARY + NAMES + potrace + libpotrace + PATHS + /usr/lib + /usr/local/lib + $ENV{DEVLIBS_PATH}/lib + ) + + if (POTRACE_LIBRARY) + set (POTRACE_FOUND TRUE) + endif (POTRACE_LIBRARY) + + set (POTRACE_INCLUDE_DIRS + ${POTRACE_INCLUDE_DIR} + ) + + if (POTRACE_FOUND) + set(POTRACE_LIBRARIES + ${POTRACE_LIBRARIES} + ${POTRACE_LIBRARY} + ) + endif (POTRACE_FOUND) + + if (POTRACE_INCLUDE_DIRS AND POTRACE_LIBRARIES) + set(POTRACE_FOUND TRUE) + endif (POTRACE_INCLUDE_DIRS AND POTRACE_LIBRARIES) + + if (POTRACE_FOUND) + if (NOT Potrace_FIND_QUIETLY) + message(STATUS "Found Potrace: ${POTRACE_LIBRARIES}") + endif (NOT Potrace_FIND_QUIETLY) + else (POTRACE_FOUND) + if (Potrace_FIND_REQUIRED) + message(FATAL_ERROR "Could not find potrace") + endif (Potrace_FIND_REQUIRED) + endif (POTRACE_FOUND) + + # show the POTRACE_INCLUDE_DIRS and POTRACE_LIBRARIES variables only in the advanced view + MARK_AS_ADVANCED(POTRACE_INCLUDE_DIRS POTRACE_LIBRARIES) + +endif (POTRACE_LIBRARIES AND POTRACE_INCLUDE_DIRS) -- cgit v1.2.3