[CMake] Forcing finding FreeGLUT instead of the system GLUT on MacOS

Alan W. Irwin Alan.W.Irwin1234 at gmail.com
Sat May 4 13:14:54 EDT 2019


On 2019-05-02 15:10+0200 ardi wrote:

> Hi,
>
> I built and installed FreeGLUT in a custom location in my home
> directory (Note: it's a custom location, but I also have pkg-config
> installed on my PATH, and I did set it up so that when I do
> 'pkg-config --list-all' it successfully detects FreeGLUT in the
> location where I installed it).
>
> Now I'm trying to build a project that has find_package(GLUT REQUIRED)
> and, as I would expect, it detects the system GLUT that comes standard
> with MacOS. But for this particular build, I want it to find FreeGLUT
> instead of the system GLUT. How can I force finding FreeGLUT?
>
> Thanks a lot in advance,

Hi ardi:

In your cmake installation take a look at

$PREFIX/share/cmake-3.14/Modules/FindGLUT.cmake

where you will find no mention of PkgConfig, i.e., CMake does not
use pkg-config to find GLUT.  Instead, it uses native CMake find
methods which are documented at e.g., <https://cmake.org/cmake/help/latest/command/find_path.html>.
And if you look into that documentation you can find a number of
environment variables that control which GLUT installation location is found
such as CMAKE_PREFIX_PATH.

Hope that helps.

Alan

__________________________
Alan W. Irwin

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________

Linux-powered Science
__________________________


More information about the CMake mailing list