Skip to content

Commit 1baa10b

Browse files
committed
build: clean up NO_GETTEXT cmake support
Make NO_GETTEXT a build option aliased to ENV{NO_GETTEXT} to pass to vcpkg_install.bat to skip building gettext. Turn it off by default when vcpkg is in-use because it's a very long compile. Also do not build translations if NO_GETTEXT is set. Signed-off-by: Rafael Kitover <[email protected]>
1 parent 55ec81d commit 1baa10b

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

contrib/buildsystems/CMakeLists.txt

+18-17
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,21 @@ if(NOT WIN32)
7272
set(USE_VCPKG OFF CACHE BOOL FORCE)
7373
endif()
7474

75+
set(gettext_default TRUE)
76+
77+
# Turn off gettext by default when using vcpkg because it's a very
78+
# long compile.
79+
if(NOT USE_VCPKG)
80+
set(gettext_default FALSE)
81+
endif()
82+
83+
build_option(
84+
NO_GETTEXT
85+
BOOL "Set to TRUE/ON to disable internationalization support using gettext and building translations using msgfmt from gettext-tools."
86+
${gettext_default}
87+
ALIASES ENV{NO_GETTEXT}
88+
)
89+
7590
if(NOT DEFINED CMAKE_EXPORT_COMPILE_COMMANDS)
7691
set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
7792
message("settting CMAKE_EXPORT_COMPILE_COMMANDS: ${CMAKE_EXPORT_COMPILE_COMMANDS}")
@@ -195,8 +210,7 @@ find_package(CURL)
195210
find_package(EXPAT)
196211
find_package(Iconv)
197212

198-
#Don't use libintl on Windows Visual Studio and Clang builds
199-
if(NOT (WIN32 AND (CMAKE_C_COMPILER_ID STREQUAL "MSVC" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")))
213+
if(NOT NO_GETTEXT)
200214
find_package(Intl)
201215
endif()
202216

@@ -229,18 +243,10 @@ if(WIN32 AND NOT MSVC)#not required for visual studio builds
229243
endif()
230244
endif()
231245

232-
if(NO_GETTEXT)
233-
message(STATUS "msgfmt not used under NO_GETTEXT")
234-
else()
246+
if(NOT NO_GETTEXT)
235247
find_program(MSGFMT_EXE msgfmt)
236248
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()
249+
message(WARNING "msgfmt not available and/or could not be installed, text translations won't be built.")
244250
endif()
245251
endif()
246252

@@ -1056,7 +1062,6 @@ set(NO_PYTHON )
10561062
set(PAGER_ENV "LESS=FRX LV=-c")
10571063
set(DC_SHA1 YesPlease)
10581064
set(RUNTIME_PREFIX true)
1059-
set(NO_GETTEXT )
10601065

10611066
if(NOT CURL_FOUND)
10621067
set(NO_CURL 1)
@@ -1066,10 +1071,6 @@ if(NOT EXPAT_FOUND)
10661071
set(NO_EXPAT 1)
10671072
endif()
10681073

1069-
if(NOT Intl_FOUND)
1070-
set(NO_GETTEXT 1)
1071-
endif()
1072-
10731074
if(NOT PERL_TESTS)
10741075
set(NO_PERL 1)
10751076
endif()

0 commit comments

Comments
 (0)