Skip to content

Commit

Permalink
build: clean up NO_GETTEXT cmake support
Browse files Browse the repository at this point in the history
Make NO_GETTEXT a build option aliased to ENV{NO_GETTEXT} to pass to
vcpkg_install.bat to skip building gettext, which is a long build.

Also do not build translations if NO_GETTEXT is set.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
  • Loading branch information
rkitover committed Mar 17, 2022
1 parent 5043cf4 commit d45e16c
Showing 1 changed file with 10 additions and 17 deletions.
27 changes: 10 additions & 17 deletions contrib/buildsystems/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ if(NOT WIN32)
set(USE_VCPKG OFF CACHE BOOL FORCE)
endif()

build_option(
NO_GETTEXT
BOOL "Set to TRUE/ON to disable internationalization support using gettext and building translations using msgfmt from gettext-tools."
FALSE
ALIASES ENV{NO_GETTEXT}
)

if(NOT DEFINED CMAKE_EXPORT_COMPILE_COMMANDS)
set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
message("settting CMAKE_EXPORT_COMPILE_COMMANDS: ${CMAKE_EXPORT_COMPILE_COMMANDS}")
Expand Down Expand Up @@ -195,8 +202,7 @@ find_package(CURL)
find_package(EXPAT)
find_package(Iconv)

#Don't use libintl on Windows Visual Studio and Clang builds
if(NOT (WIN32 AND (CMAKE_C_COMPILER_ID STREQUAL "MSVC" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")))
if(NOT NO_GETTEXT)
find_package(Intl)
endif()

Expand Down Expand Up @@ -229,18 +235,10 @@ 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()
if(NOT NO_GETTEXT)
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()

Expand Down Expand Up @@ -1056,7 +1054,6 @@ set(NO_PYTHON )
set(PAGER_ENV "LESS=FRX LV=-c")
set(DC_SHA1 YesPlease)
set(RUNTIME_PREFIX true)
set(NO_GETTEXT )

if(NOT CURL_FOUND)
set(NO_CURL 1)
Expand All @@ -1066,10 +1063,6 @@ if(NOT EXPAT_FOUND)
set(NO_EXPAT 1)
endif()

if(NOT Intl_FOUND)
set(NO_GETTEXT 1)
endif()

if(NOT PERL_TESTS)
set(NO_PERL 1)
endif()
Expand Down

0 comments on commit d45e16c

Please sign in to comment.