How to make FindOpenAL prefer OpenAL Soft on macOS

With openal-soft installed from Homebrew, setting OPENALDIR=$(brew --prefix openal-soft) does not seem to have any effect. This is tested on Travis for Alure (see builds 133 to 137).

This is originally opened as issue 20334 but was then classified by maintainer as a question.

I’ve re-opened the issue because the priority of the OPENALDIR environment variable does not seem to be high enough.

In general however find modules don’t have such project-specific environment variables. To control the search paths, see the find_package command documentation on search procedure. One can add the installation prefixes of dependencies to CMAKE_PREFIX_PATH either in the environment or as a cache entry (it is a ;-separated list). Or, with policy CMP0074 set to NEW one can use the <PackageName>_ROOT cache entry or environment variable. It would be called OpenAL_ROOT in this case.

1 Like