From 47fb9653b86986a76d9a5dd67955ffd598755e17 Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch Date: Fri, 22 Oct 2021 15:04:24 +0200 Subject: Bump the CMake version requirement, fix Windows - Add a missing runtime library for gettext-tools. - Remove the no longer necessary customized FindGettext.cmake, since the downloaded gettext binaries are new enough. - Make the installer at least ask to uninstall previous versions. - Adjust the PATH of tests so that they'll run on Windows directly. - Fix quoting so that the project will build inside paths with spaces. - Resolve a GSettings deprecation warning. - Update the README's build instructions as appropriate. - Require CMake 3.9 because of the README's suggestion to fix FindPkgConfig.cmake manually using separate_arguments(UNIX_COMMAND). Tested build configurations: - native Arch Linux, - native Windows XP with the newest NSIS, - Arch Linux Mingw-w64 i686 Win32Depends.cmake NSIS cross-build + XP, - Arch Linux Mingw-w64 x86_64 MSYS2 NSIS cross-build + Windows 10. Detected issues: - The file save dialog will not add the extension automatically, seen with MSYS2. --- cmake/FindGettext.cmake | 99 ------------------------------------------------- 1 file changed, 99 deletions(-) delete mode 100644 cmake/FindGettext.cmake (limited to 'cmake') diff --git a/cmake/FindGettext.cmake b/cmake/FindGettext.cmake deleted file mode 100644 index 5b66acb..0000000 --- a/cmake/FindGettext.cmake +++ /dev/null @@ -1,99 +0,0 @@ -# - 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. -# -# Additionally it provides the following macros: -# GETTEXT_CREATE_TRANSLATIONS ( outputFile [ALL] file1 ... fileN ) -# This will create a target "${PROJECT_NAME}_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. - -#============================================================================= -# Copyright 2007-2009 Kitware, Inc. -# Copyright 2010-2011 Přemysl Eric Janouch -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the name of the Kitware nor the names of contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY -# OF SUCH DAMAGE. -#============================================================================= - -find_program (GETTEXT_MSGMERGE_EXECUTABLE msgmerge) -find_program (GETTEXT_MSGFMT_EXECUTABLE msgfmt) - -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 (_potBasename ${_potFile} NAME_WE) - get_filename_component (_absPotFile ${_potFile} ABSOLUTE) - - set (_addToAll) - if (${_firstPoFile} STREQUAL "ALL") - set (_addToAll "ALL") - set (_firstPoFile) - endif (${_firstPoFile} STREQUAL "ALL") - - 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) - - # msgmerge versions older than 0.11 don't actually support --update - # and --backup, let's try to workaround that (tested on 0.10.40). - execute_process (COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} -V - OUTPUT_VARIABLE _msgmergeVersion) - string (REGEX MATCH "0[.][0-9]+" _msgmergeVersion ${_msgmergeVersion}) - if ("${_msgmergeVersion}" MATCHES "[.]10|[.][0-9]") - set (_msgmergeParams --quiet -s - ${_absFile} -o ${_absFile} ${_absPotFile}) - else ("${_msgmergeVersion}" MATCHES "[.]10|[.][0-9]") - set (_msgmergeParams --quiet --update --backup=none -s - ${_absFile} ${_absPotFile}) - endif ("${_msgmergeVersion}" MATCHES "[.]10|[.][0-9]") - - add_custom_command ( - OUTPUT ${_gmoFile} - COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} ${_msgmergeParams} - 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 (_currentPoFile) - - add_custom_target (${PROJECT_NAME}_translations ${_addToAll} - DEPENDS ${_gmoFiles}) -endmacro (GETTEXT_CREATE_TRANSLATIONS) - -include (FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS (Gettext DEFAULT_MSG - GETTEXT_MSGMERGE_EXECUTABLE GETTEXT_MSGFMT_EXECUTABLE) - - -- cgit v1.2.3-70-g09d2