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