diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index e13fc8bfe69591..7e327d4c07a039 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -72,6 +72,21 @@ if(NOT WIN32) set(USE_VCPKG OFF CACHE BOOL FORCE) endif() +set(gettext_default TRUE) + +# Turn off gettext by default when using vcpkg because it's a very +# long compile. +if(NOT USE_VCPKG) + set(gettext_default FALSE) +endif() + +build_option( + NO_GETTEXT + BOOL "Set to TRUE/ON to disable internationalization support using gettext and building translations using msgfmt from gettext-tools." + ${gettext_default} + 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 +210,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 +243,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 +1062,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 +1071,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()