How to fix CMake build error on Ubuntu: Could NOT find GLEW (missing: GLEW_INCLUDE_DIR GLEW_LIBRARY)

Problem:

While building a software project using cmake, you see error messages like

CMake Error at /usr/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find GLEW (missing: GLEW_INCLUDE_DIR GLEW_LIBRARY)
Call Stack (most recent call first):
  /usr/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
  cmake/FindGLEW.cmake:38 (find_package_handle_standard_args)
  CMakeLists.txt:743 (find_package

Solution

Install libglew-dev

sudo apt -y install libglew-dev