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 From 0290dcac6a900038f2950f21efb95f495c1fc8de Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Mon, 11 Jan 2016 15:02:29 +0000 Subject: Update CMake for poppler >= 0.20.0 dependency (bzr r14574) --- CMakeScripts/Modules/FindPopplerCairo.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'CMakeScripts/Modules') diff --git a/CMakeScripts/Modules/FindPopplerCairo.cmake b/CMakeScripts/Modules/FindPopplerCairo.cmake index 2565e7bb2..bde884ec6 100644 --- a/CMakeScripts/Modules/FindPopplerCairo.cmake +++ b/CMakeScripts/Modules/FindPopplerCairo.cmake @@ -23,9 +23,9 @@ else (POPPLER_LIBRARIES AND POPPLER_INCLUDE_DIRS) # in the FIND_PATH() and FIND_LIBRARY() calls find_package(PkgConfig) if (PKG_CONFIG_FOUND) - INKSCAPE_PKG_CONFIG_FIND(POPPLER poppler >=0.5.9 poppler-config.h poppler poppler) + INKSCAPE_PKG_CONFIG_FIND(POPPLER poppler >=0.20.0 poppler-config.h poppler poppler) if (POPPLER_FOUND) - INKSCAPE_PKG_CONFIG_FIND(POPPLER_GLIB poppler-glib >=0.5.9 poppler/glib/poppler.h "" poppler-glib) + INKSCAPE_PKG_CONFIG_FIND(POPPLER_GLIB poppler-glib >=0.20.0 poppler/glib/poppler.h "" poppler-glib) if (POPPLER_GLIB_FOUND) list(APPEND POPPLER_INCLUDE_DIRS ${POPPLER_GLIB_INCLUDE_DIRS}) list(APPEND POPPLER_LIBRARIES ${POPPLER_GLIB_LIBRARIES}) @@ -36,7 +36,7 @@ else (POPPLER_LIBRARIES AND POPPLER_INCLUDE_DIRS) endif (CAIRO_SVG_FOUND) endif (POPPLER_GLIB_FOUND) if (ENABLE_POPPLER_CAIRO) - INKSCAPE_PKG_CONFIG_FIND(POPPLER_CAIRO poppler-cairo >=0.5.9 cairo.h cairo cairo) + INKSCAPE_PKG_CONFIG_FIND(POPPLER_CAIRO poppler-cairo >=0.20.0 cairo.h cairo cairo) if (POPPLER_GLIB_FOUND AND POPPLER_CAIRO_FOUND AND NOT CAIRO_SVG_FOUND) list(APPEND POPPLER_INCLUDE_DIRS ${POPPLER_CAIRO_INCLUDE_DIRS}) list(APPEND POPPLER_LIBRARIES ${POPPLER_CAIRO_LIBRARIES}) -- cgit v1.2.3 From 53a4d10251bb079fa22ced4dcbb381f42f56ceb1 Mon Sep 17 00:00:00 2001 From: Bryce Harrington Date: Sat, 27 Feb 2016 01:25:50 -0800 Subject: cmake: Add sigc++ support Patch from rindolf Signed-off-by: Bryce Harrington (bzr r14669) --- CMakeScripts/Modules/FindSigC++.cmake | 22 +++++++++++++++++++++- CMakeScripts/Modules/sigcpp_test.cpp | 15 +++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 CMakeScripts/Modules/sigcpp_test.cpp (limited to 'CMakeScripts/Modules') diff --git a/CMakeScripts/Modules/FindSigC++.cmake b/CMakeScripts/Modules/FindSigC++.cmake index ed0abc545..8046410b5 100644 --- a/CMakeScripts/Modules/FindSigC++.cmake +++ b/CMakeScripts/Modules/FindSigC++.cmake @@ -13,7 +13,6 @@ # For details see the accompanying COPYING-CMAKE-SCRIPTS file. # - if (SIGC++_LIBRARIES AND SIGC++_INCLUDE_DIRS) # in cache already set(SIGC++_FOUND TRUE) @@ -103,4 +102,25 @@ else (SIGC++_LIBRARIES AND SIGC++_INCLUDE_DIRS) endif (SIGC++_LIBRARIES AND SIGC++_INCLUDE_DIRS) +# Try to add -std=c++11 if needed - see: +# https://bugs.launchpad.net/inkscape/+bug/1488079 + +macro (sigcpp_compile extra_cppflags) + try_compile(SIGCPP_COMPILES_FINE "${CMAKE_BINARY_DIR}/sigcpp-bindir" + SOURCES "${CMAKE_SOURCE_DIR}/CMakeScripts/Modules/sigcpp_test.cpp" + COMPILE_DEFINITIONS ${_SIGC++_CFLAGS} ${extra_cppflags} + LINK_LIBRARIES ${SIGC++_LIBRARIES}) +endmacro() + + +sigcpp_compile("") +if (NOT "${SIGCPP_COMPILES_FINE}") + set (cppflag "-std=c++11") + sigcpp_compile("${cppflag}") + if ("${SIGCPP_COMPILES_FINE}") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${cppflag}") + else() + message(FATAL_ERROR "Could not compile against SIGC++") + endif() +endif() diff --git a/CMakeScripts/Modules/sigcpp_test.cpp b/CMakeScripts/Modules/sigcpp_test.cpp new file mode 100644 index 000000000..b4cf2c773 --- /dev/null +++ b/CMakeScripts/Modules/sigcpp_test.cpp @@ -0,0 +1,15 @@ +/* + * Building this using: + + g++ `pkg-config --cflags sigc++-2.0` sigcpp_test.cpp + + Results in an error. + * */ +#include +#include +#include + +int main() +{ + return 0; +} -- cgit v1.2.3