From 4aeb5bbff254c85eeb5e51a34a90c107a6a7b25a Mon Sep 17 00:00:00 2001 From: Rafael Kitover Date: Tue, 15 Feb 2022 13:26:57 +0000 Subject: [PATCH] build: use NuGet Gettext.Tools for msgfmt on WIN32 Use the nuget_install() function introduced in 3b05adf3c4 (build: add nuget_install() in cmake/NuGet.cmake, 2022-02-10) to download the Gettext.Tools package for the msgfmt utility on Windows if it's not available. Signed-off-by: Rafael Kitover --- contrib/buildsystems/CMakeLists.txt | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index e13fc8bfe69591..a1907522db6060 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -229,18 +229,21 @@ if(WIN32 AND NOT MSVC)#not required for visual studio builds endif() endif() -if(NO_GETTEXT) - message(STATUS "msgfmt not used under NO_GETTEXT") -else() +find_program(MSGFMT_EXE msgfmt) + +if(NOT MSGFMT_EXE) + if(WIN32) + include(NuGet) + nuget_install(Gettext.Tools) + endif() + + unset(MSGFMT_EXE) + unset(MSGFMT_EXE CACHE) + find_program(MSGFMT_EXE msgfmt) + if(NOT MSGFMT_EXE) - if(USE_VCPKG) - set(MSGFMT_EXE ${CMAKE_SOURCE_DIR}/compat/vcbuild/vcpkg/downloads/tools/msys2/msys64/usr/bin/msgfmt.exe) - endif() - if(NOT EXISTS ${MSGFMT_EXE}) - message(WARNING "Text Translations won't be built") - unset(MSGFMT_EXE) - endif() + message(WARNING "msgfmt not available and/or could not be installed, text translations won't be built.") endif() endif()