From d7901d965116f104e2550ddda6517fbf13c340c3 Mon Sep 17 00:00:00 2001 From: Rafael Kitover Date: Thu, 10 Feb 2022 15:28:14 +0000 Subject: [PATCH] Use NuGet pkg Gettext.Tools for msgfmt on WIN32. Use the nuget_install() function introduced in 5c2d0afc7c 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 | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index 8cab32ba27b148..2567116fdb94b5 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -222,18 +222,22 @@ 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()