18.04 – CMake could not find OpenGL (missing: OPENGL_glx_LIBRARY)

I’m trying to install freeglut-3.0.0 downloaded as source code from sourceforge.

When I type cmake . then it shows error Could not find OpenGL (missing: OPENGL_glx_LIBRARY)

As there are many questions and answers for this problem on stackoverflow, askubuntu and github. I tried given suggestions from these questions (here, here, here, here, here, here and many others….) and when I install any package by following suggestions then I always get package_name is already the newest version but problem remains same.

In many suggestions and answers it is mentioned that these libraries are already installed by Nvidia driver and it seems that these libraries are installed in my PC but Cmake can’t find it.

My PC configuration is

  • Ubuntu 18.04
  • Nvidia Driver 440.100

May be my this question seems to be duplicate of many questions but I’m unable to find any solution for my problem.

Looking for some kind suggestions.