Skip to content

Commit 4aeb5bb

Browse files
committed
build: use NuGet Gettext.Tools for msgfmt on WIN32
Use the nuget_install() function introduced in 3b05adf (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 <[email protected]>
1 parent 62ae805 commit 4aeb5bb

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

contrib/buildsystems/CMakeLists.txt

+13-10
Original file line numberDiff line numberDiff line change
@@ -229,18 +229,21 @@ if(WIN32 AND NOT MSVC)#not required for visual studio builds
229229
endif()
230230
endif()
231231

232-
if(NO_GETTEXT)
233-
message(STATUS "msgfmt not used under NO_GETTEXT")
234-
else()
232+
find_program(MSGFMT_EXE msgfmt)
233+
234+
if(NOT MSGFMT_EXE)
235+
if(WIN32)
236+
include(NuGet)
237+
nuget_install(Gettext.Tools)
238+
endif()
239+
240+
unset(MSGFMT_EXE)
241+
unset(MSGFMT_EXE CACHE)
242+
235243
find_program(MSGFMT_EXE msgfmt)
244+
236245
if(NOT MSGFMT_EXE)
237-
if(USE_VCPKG)
238-
set(MSGFMT_EXE ${CMAKE_SOURCE_DIR}/compat/vcbuild/vcpkg/downloads/tools/msys2/msys64/usr/bin/msgfmt.exe)
239-
endif()
240-
if(NOT EXISTS ${MSGFMT_EXE})
241-
message(WARNING "Text Translations won't be built")
242-
unset(MSGFMT_EXE)
243-
endif()
246+
message(WARNING "msgfmt not available and/or could not be installed, text translations won't be built.")
244247
endif()
245248
endif()
246249

0 commit comments

Comments
 (0)