Skip to content

Commit

Permalink
Provide a manual cmake flag to turn off libintl.
Browse files Browse the repository at this point in the history
This is likely to be useful for people building out-of-tree clients of
libtarmac: partly because the sudden dependency on libintl might be
inconvenient for them, and also because the use of libintl might not
even work if their own application doesn't integrate libintl and
provide message translations.

(It's possible that to support out-of-tree libtarmac clients fully, we
might need to separate the messages in this project into a set for the
library and a set for the applications. But this switch is surely
_also_ useful.)
  • Loading branch information
statham-arm committed Jan 29, 2024
1 parent 9df044e commit 27c9545
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions cmake/unix.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@

find_package(Curses ${REQUIRED_PACKAGE})
find_package(PkgConfig ${REQUIRED_PACKAGE})
find_package(Gettext)
find_package(Intl)

include(GNUInstallDirs)
include(CheckSymbolExists)
Expand All @@ -32,7 +30,17 @@ check_symbol_exists(wcswidth "wchar.h" HAVE_WCSWIDTH)
set(LOCALEDIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LOCALEDIR}
CACHE STRING "Directory to find gettext locale files in.")

# USE_LIBINTL: user-facing option to not even _try_ to link with libintl
set(USE_LIBINTL ON
CACHE BOOL "Use libintl for message internationalisation if possible")

# HAVE_LIBINTL: whether we turn out to be _actually_ linking with
# libintl (requiring it to be enabled, _and_ found at configure time)
set(HAVE_LIBINTL 0)
if(Intl_FOUND)
set(HAVE_LIBINTL 1)
if(USE_LIBINTL)
find_package(Gettext)
find_package(Intl)
if(Intl_FOUND)
set(HAVE_LIBINTL 1)
endif()
endif()

0 comments on commit 27c9545

Please sign in to comment.