Skip to content

Commit 2ae6d98

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 e68ce8a commit 2ae6d98

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

contrib/buildsystems/CMakeLists.txt

+14-10
Original file line numberDiff line numberDiff line change
@@ -221,18 +221,22 @@ if(WIN32 AND NOT MSVC)#not required for visual studio builds
221221
endif()
222222
endif()
223223

224-
if(NO_GETTEXT)
225-
message(STATUS "msgfmt not used under NO_GETTEXT")
226-
else()
224+
225+
find_program(MSGFMT_EXE msgfmt)
226+
227+
if(NOT MSGFMT_EXE)
228+
if(WIN32)
229+
include(NuGet)
230+
nuget_install(Gettext.Tools)
231+
endif()
232+
233+
unset(MSGFMT_EXE)
234+
unset(MSGFMT_EXE CACHE)
235+
227236
find_program(MSGFMT_EXE msgfmt)
237+
228238
if(NOT MSGFMT_EXE)
229-
if(USE_VCPKG)
230-
set(MSGFMT_EXE ${CMAKE_SOURCE_DIR}/compat/vcbuild/vcpkg/downloads/tools/msys2/msys64/usr/bin/msgfmt.exe)
231-
endif()
232-
if(NOT EXISTS ${MSGFMT_EXE})
233-
message(WARNING "Text Translations won't be built")
234-
unset(MSGFMT_EXE)
235-
endif()
239+
message(WARNING "msgfmt not available and/or could not be installed, text translations won't be built.")
236240
endif()
237241
endif()
238242

0 commit comments

Comments
 (0)