[CMake] Find packages coming from homebrew
Roger Leigh
rleigh at codelibre.net
Wed Nov 23 16:12:27 EST 2016
On 23/11/16 14:55, Cedric Doucet wrote:
>
> Hello,
>
> I would like to write some FindFoo.cmake files to find packages
> installed on different systems including Mac.
> I have noticed that homebrew install packages in a repertory whose name
> depends on the version of the package.
> For example, I have installed a scientific library called scotch, and it
> is now installed here:
>
> /usr/local/Cellar/scotch/6.0.4_4
You should never need to use the Cellar directories directly. It should
also be linked under /usr/local/opt/scotch *and* linked directly into
/usr/local.
When writing a FindFoo.cmake file, you shouldn't need to do anything
special to handle this. Just find the headers and libraries as usual.
If it's linked into /usr/local (brew link scotch) then it should be
picked up without any special action
If it's not linked into /usr/local then the user should be able to add
/usr/local/opt/scotch (or /usr/local/Cellar/scotch/nnnn) to
CMAKE_PREFIX_PATH and it should then be picked up, again with no special
casing in your FindFoo script
Regards,
Roger
More information about the CMake
mailing list