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正确编译。linux
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,浪费我时间。git
p.s. 若是cmake报错提示:
Could NOT find OpenGL (missing: OPENGL_opengl_LIBRARY OPENGL_glx_LIBRARY
OPENGL_INCLUDE_DIR)github
则须要安装:
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)ui
则须要安装:
sudo apt-get install libglu1-mesa-devthis