From 92cbe2d1d80cfd082012723886365646985eb130 Mon Sep 17 00:00:00 2001 From: Rafael Kitover Date: Thu, 17 Mar 2022 18:28:50 +0000 Subject: [PATCH] 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, which is a long build. Also do not build translations if NO_GETTEXT is set. Signed-off-by: Rafael Kitover --- contrib/buildsystems/CMakeLists.txt | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index e13fc8bfe69591..971b20586215b2 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -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}") @@ -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() @@ -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() @@ -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) @@ -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()