Skip to content

Commit 44fe965

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 500d738 commit 44fe965

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

contrib/buildsystems/CMakeLists.txt

+13-8
Original file line numberDiff line numberDiff line change
@@ -229,17 +229,22 @@ 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+
if(NOT NO_GETTEXT)
235233
find_program(MSGFMT_EXE msgfmt)
234+
236235
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)
236+
if(WIN32)
237+
include(NuGet)
238+
nuget_install(Gettext.Tools)
239239
endif()
240-
if(NOT EXISTS ${MSGFMT_EXE})
241-
message(WARNING "Text Translations won't be built")
242-
unset(MSGFMT_EXE)
240+
241+
unset(MSGFMT_EXE)
242+
unset(MSGFMT_EXE CACHE)
243+
244+
find_program(MSGFMT_EXE msgfmt)
245+
246+
if(NOT MSGFMT_EXE)
247+
message(WARNING "msgfmt not available and/or could not be installed, text translations won't be built.")
243248
endif()
244249
endif()
245250
endif()

0 commit comments

Comments
 (0)