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.

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]>
  • Loading branch information
rkitover committed Mar 21, 2022
1 parent 55ec81d commit 1baa10b
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions contrib/buildsystems/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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)
Expand All @@ -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()
Expand Down

0 comments on commit 1baa10b

Please sign in to comment.