基于cmake编译glew

cmake已经成为了C/C++开源项目的主流构建工具。glew也提供了cmake的脚本,但用cmake编译glew容易采坑:glew的github上的代码,无论是master分支还是glew-2.1.0这个tag,都无法正确用cmake编译(Linux、OSX亲测,均失败);必须从sourceforge上下载glew,sourceforge下载的glew-2.1.0.tgz才能被cmake正确编译。

tar -zxvf glew-2.1.0.tgz
cd glew-2.1.0
cd build
mkdir linux
cd linux
cmake ../cmake -DCMAKE_INSTALL_PREFIX=./install
make

你个混球,@Nigel Stewart,浪费我时间。

p.s. 如果cmake报错提示:
Could NOT find OpenGL (missing: OPENGL_opengl_LIBRARY OPENGL_glx_LIBRARY
OPENGL_INCLUDE_DIR)

则需要安装:
sudo apt-fast install libgl1-mesa-dev

如果cmake报错提示:
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
OPENGL_glu_LIBRARY (ADVANCED)

则需要安装:
sudo apt-get install libglu1-mesa-dev

原文地址:https://www.cnblogs.com/zjutzz/p/10982675.html