We need gettext for our build so it was added to homebrew.packages. However it simply reports “Skipping install of gettext formula. It is already up-to-date” and does not do anything. But it is not linked properly so CMake is unable to find it (msgmerge and msgfmt executables are not found in standard paths)
The solution so far was to issue brew link gettext --force
This is quite inconvenient as it does mean one needs an additional, OSX-specific install step.
Can this be fixed at an upper level? Or can this force-link option be integrated into the homebrew addon?
This is not the way you do it.
Homebrew’s gettext
formula is intentionally keg-only because it would otherwise conflict with stock MacOS software:
$ brew info gettext
<...>
==> Caveats
gettext is keg-only, which means it was not symlinked into /usr/local,
because macOS provides the BSD gettext library & some software gets confused if both are in the library path.
If you need to have gettext first in your PATH run:
echo 'export PATH="/usr/local/opt/gettext/bin:$PATH"' >> ~/.bash_profile
For compilers to find gettext you may need to set:
export LDFLAGS="-L/usr/local/opt/gettext/lib"
export CPPFLAGS="-I/usr/local/opt/gettext/include"
CMake honors these envvars when configuring the compiler.